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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Longitude Validation
Expression
^-?([1]?[1-7][1-9]|[1]?[1-8][0]|[1-9]?[0-9])\.{1}\d{1,6}
Description
Longitude validation (similiar to Latitude Validation) and inspired by the same code
Matches
180.0, -180.0, 98.092391
Non-Matches
181, 180, -98.0923913
Author Rating: The rating for this expression. Jason Rutberg
Source
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: try this
Name: Trung
Date: 4/15/2015 8:15:36 PM
Comment:
try this. It works with both +/- 100-109. ^[+|-]?([1]?[0-7][1-9]|[1]?[0-8][0]|[1][0][0-9]|[0-9]?[0-9])(\.{1}\d{1,6})?$


Title: Bug - watch out
Name: Vojtech
Date: 10/17/2013 6:15:56 AM
Comment:
Guys watch out there is a bug, just caused me critical PROD issue. Author, can you please fix this regex or take it down its fairly cheeky to find out its wrong !! Basic test like max/min and zero works fine but range in between 101-109 is missed out.


Title: Bug
Name: Toma
Date: 7/25/2008 12:50:04 PM
Comment:
try this to solve the 100 - 109 error range : ^-?([1]?[1-7][1-9]|[1]?[1-8][0]|[1][0][0-9]|[1-9]?[0-9])\.{1}\d{1,6}


Title: Bug
Name: Toma
Date: 7/25/2008 12:49:54 PM
Comment:
try this to solve the 100 - 109 error range : ^-?([1]?[1-7][1-9]|[1]?[1-8][0]|[1][0][0-9]|[1-9]?[0-9])\.{1}\d{1,6}


Title: Doesn't work...
Name: MJ
Date: 6/25/2007 2:20:31 PM
Comment:
I tested it and 101-109 (both negative and positive) find no matches.


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