regex for latitude and longitude
match latitude-longitude value
^((\-?|\+?)?\d+(\.\d+)?),\s*((\-?|\+?)?\d+(\.\d+)?)$
Regex Flags
global match
?
ignore case
?
multiline
?
dotAll
?
unicode
?
sticky
?
+90.0, -127.554334
45, 180
-90.000, -180.0
20,80
47.1231231, 179.99999999
-90., -180.
045, 180
Latitude and longitude values are usually found comma seperated to denote a location on the globe
This would work for any comma-separated values that can optionally have + or - as prefix.
Cheatsheet
expr | usage |
---|---|
/\d/ | matches any digit |
/(hard)?work/ | matches "work" or "hardwork" |
/i am a (cat|dog|whale) person/ | matches "i am a cat person", "i am a dog person" and "i am a whale person" |
iHateRegex
by
geon