Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
^(?:[-+]?[1-8]?\d(?:\.\d{0,7})?|90(?:\.0{0,7})?),(?:[-+]?(?:180(?:\.0{0,7})?|(?:(?:1[0-7]\d)|(?:[1-9]?\d))(?:\.\d{0,7})?))$
/

Description

Matches a geolocation coordinates string consisting of latitude and longitude separated by a comma with up to 7 decimal places precision.

Submitted by Steve Piercy - 9 years ago