Regular Expressions 101

Community Patterns

DegreeMinuteSecond Geomapping

0

Regular Expression
PCRE (PHP <7.3)

/
([+-]? ?[0-9]{1,3}(deg|°|\*)) ?([0-9]{1,2}\.?[0-9]*?(min|'|| ))? ?([0-9]{1,2}\.?[0-9]*?(sec|"|| ))?( ?[NSEW]?)
/
gi

Description

Valid Location will have exactly 2 Matches and upwards of as many as 9 groups Degree must be followed with one of deg, °, or * Minutes can be ' ’ or min (2nd char: ’ is E2 80 99 or U+2019) curly quote that Word often changes Seconds can be ", ”, or sec (2nd char: ” is E2 80 9D or U+201D) Seconds can have decimal values

Submitted by anonymous - 5 years ago