Skip to content

Instantly share code, notes, and snippets.

@vieko
Created April 8, 2015 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vieko/4992386ac3a83cb79bee to your computer and use it in GitHub Desktop.
Save vieko/4992386ac3a83cb79bee to your computer and use it in GitHub Desktop.
Regular Expressions for Location Formats
lsd:
/\D*([0-9]{1,2}|sw|nw|ne|se)\D+([0-9]{1,2})\D+([0-9]{1,3})\D+([0-9]{1,2})\D*(w|e)([0-9])/i
uwi_lsd:
/\D*(1[0-9A-Z]{2})\D+([0-9]{1,2})\D+([0-9]{1,2})\D+([0-9]{1,3})\D+([0-9]{1,2})\D*(w|e)([0-9])\D([0-9]){2}/i
uwi_nts:
/\D*(2[0-9A-Z]{2})\W+([A-D]{1})[\s|\-]*(\d+)[\s|\-]*([A-L]{1})[\s|\/|\-]*([0-9]+)[\s|\-]*([A-P]{1})[\s|\-]*([0-9]+)\D([0-9]){2}/i
nts:
/([A-D]{1})[\s|\-]*(\d+)[\s|\-]*([A-L]{1})[\s|\/|\-]*([0-9]+)[\s|\-]*([A-P]{1})[\s|\-]*([0-9]+)/i
utm:
/([0-9]+)([N|S])\D+([0-9]+)\D+([0-9]+)/i
latlng:
/^\s*(\-?\d+(?:\.\d+)?)[,|\s|°]+(\-?\d+(?:\.\d+)?)[\s|°]*$/
address:
/(.*),(.*),(.*),?(.*)?/i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment