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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find DMS Coordinate
Expression
[0-9]{1,2}[:|°][0-9]{1,2}[:|'](?:\b[0-9]+(?:\.[0-9]*)?|\.[0-9]+\b)"?[N|S|E|W]
Description
Matches common Degree, Minute, Second coordinate values. The last part can be easily modified to be latitude or longitude specific by changing [N|S|E|W] to [N|S] for latitude or [E|W] for longitude.
Matches
12:12:12.223546"N|12:12:12.2246N|15:17:6"S|12°30'23.256547"S
Non-Matches
12.2225|15.25.257S|AA:BB:CC.DDS
Author Rating: Not yet rated. Kurt
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: Alternation Symbol | is Just a Regular Character Inside a Character Class []
Name: Bruce
Date: 10/21/2011 7:39:28 PM
Comment:
The | in [N|S|E|W] is not an or symbol. Inside a character class [], | is just a regular character. So this will match an N or S or E or W or |. [NSEW] is the proper format.


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