RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Longitude (decimal)
Expression
^-?(?:180(?:(?:\.0{1,6})?)|(?:[0-9]|[1-9][0-9]|1[1-7][0-9])(?:(?:\.[0-9]{1,6})?))$
Description
[-180.000000 ... 180.000000] Decimal places: up to 6. You can increase precision by replacing {1,6} with {1,your_number}
Matches
-180; -180.0; -179.99; 0.000; 179.99; 180.0; 180
Non-Matches
-200; -180.1; 180.1; 200
Author Rating: The rating for this expression. Zygimantas Berziunas
Source http://www.berziunas.com
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Doesn't work for my longitude of 104.5
Name: Tori Kelly
Date: 12/31/2020 10:55:25 PM
Comment:
Please edit this regex to allow a 0 in the tens place.


Title: Regex has an error
Name: Scott
Date: 9/29/2011 3:42:52 PM
Comment:
The regex string for Longitude won't allow anything between 100 and 109. It appears that this is because the second digit in three number strings if being limited to [1-7]. If I change 1[1-7][0-9] to 1[0-7][0-9], it works fine.


Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials