Skip to content

Instantly share code, notes, and snippets.

@klzns
Last active August 29, 2015 14:05
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 klzns/b5fabac4d191f443cab8 to your computer and use it in GitHub Desktop.
Save klzns/b5fabac4d191f443cab8 to your computer and use it in GitHub Desktop.
Regular Expression for an array of coordinates

Regex

\[(?:\[(?:(?:-|)\d+?(?:(?:\.\d+?|))\,(?:(?:-|)\d+?(?:(?:\.\d+?|))))\](?:\,(?!\])|))+?\]

Sample input

[[-80.190262,25.774252],[-66.118292,18.466465],[-64.75737,32.321384],[-80.190262,25.774252]]

Debuggex

https://www.debuggex.com/r/GQPQcgTGWTB4iOLK/0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment