Title |
Test
Find
Latitude as decimal
|
Expression |
^-?([1-8]?[0-9]\.{1}\d{1,6}$|90\.{1}0{1,6}$) |
Description |
Matches a latitude in the range of -90 to 90 degrees, with between 1 and 6 trailing decimal places. |
Matches |
-90.0 -77.284382 89.999999 1.0001 |
Non-Matches |
-90.1 90.12345 91 -20.1234567 -90 90 |
Author |
Rating:
Nick Floersch
|
Source |
Some guy named AdRock at PHPFreaks.com inspired this code |
Your Rating |
|
Title: Thanks
Name: Nate
Date: 9/29/2010 5:08:35 PM
Comment:
Thanks, works well. I tweaked it to go to 7 desimal places as the new version of google geocoding returns that much precision.
Title: Good stuff.
Name: Don Gillespie
Date: 9/7/2009 10:20:37 PM
Comment:
Works fine. Tested it extensively with Firefox regex tester. Some GPS readouts appear as "N 35.993884" instead of just a decimal number. That can be fixed as follows, to allow an optional space after the N or S, but not after the minus.
^(N\s?|S\s?|-)?([1-8]?[0-9]\.{1}\d{1,6}$|90\.{1}0{1,6}$)