Title |
Test
Find
Longitude as decimal
|
Expression |
^-?((([1]?[0-7][0-9]|[1-9]?[0-9])\.{1}\d{1,6}$)|[1]?[1-8][0]\.{1}0{1,6}$) |
Description |
Matches a longitude in the range of -180 to 180 degrees, with between 1 and 6 trailing decimal places. |
Matches |
-180.0 180.0 -179.010293 1.123456 -45.012 0.12 |
Non-Matches |
180 -180 180.1 -180.1 0.1234567 190.1 |
Author |
Rating:
Nick Floersch
|
Source |
Some guy named AdRock at PHPFreaks.com inspired this code |
Your Rating |
|
Title: Good stuff.
Name: Don Gillespie
Date: 9/7/2009 10:15:42 PM
Comment:
Good stuff. Tested it extensively with Firefox regex tester. Some GPS readings come out with "W 82.884833" instead of just a decimal. That's easy to test for:
^(E\s?|W\s?|-)?((([1]?[0-7][0-9]|[1-9]?[0-9])\.{1}\d{1,6}$)|[1]?[1-8][0]\.{1}0{1,6}$)