Click here to Skip to main content
15,039,037 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
Hey Guys

Can someone please help with with finding the latitude and longitude values from these strings:
lon:9.405 lat:54.903
or
lon 9.405 lat 54.903
using regex.

Best regards
Posted

1 solution

Hello Paw,

Here's a pattern to find the LON and then insert it into a group called "lon":
C#
string patternToFindLON = @"lon(\s|:)*(?<lon>[0-9]*(.[0-9]*))";

And the same idea to find the LAT

Cheers,
Edo
   
v4
Comments
Paw Jershauge 20-Feb-13 4:42am
   
Thanks alot Edo ;)
Joezer BH 20-Feb-13 4:47am
   
You are most welcome :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900