Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^(((-?(\d{1,3})(\.\d+)?) (-?(\d{1,3})(\.\d+)?)),\s*){3,}$
/

Description

Validates whether a list of long/lat coordinate pairs are valid. Requires at least 3 pairs, and requires comma at the end of the final pair. Each single coordinate is separated by a space, and all coordinate pairs must be separated by a comma

Submitted by anonymous - 5 years ago