jquery - Extract Latitude and Longitude by Javascript from String -


how extract latitude , longitude below url using javascript/regex .

https://www.google.co.in/maps/search/wipro+technologies/@12.974267,80.2238546,13z/data=!3m1!4b1?hl=en

i want 12.974267 assigned variable , 80.2238546 longitude variable

thanks in advance

without regex: fiddle

var url = 'https://www.google.co.in/maps/search/wipro+technologies/@12.974267,80.2238546,13z/data=!3m1!4b1?hl=en';  var spliturl = url.split('@'); var coords = spliturl[1].split(',');  console.log(coords[0]); // 12.974267 console.log(coords[1]); // 80.2238546 

regex: /@\d+\.\d+,\d+\.\d+/


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -