Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@schoenobates
Created April 22, 2016 12:51
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 schoenobates/7a7c3c383c5ce9e5a1f1fe4a914897de to your computer and use it in GitHub Desktop.
Save schoenobates/7a7c3c383c5ce9e5a1f1fe4a914897de to your computer and use it in GitHub Desktop.
WKT Polygon Regex Validator: Whitespace and First/Last point validation in linear ring... needs to check for more than one two points per linear ring
POLYGON\s*\(\s*(\(\s*(?<X>\-?\d+(:?\.\d+)?)\s+(?<Y>\-?\d+(:?\.\d+)?)(?:\s*,\s*\-?\d+(:?\.\d+)?\s+\-?\d+(:?\.\d+)?)*\s*,\s*\k<X>\s+\k<Y>\s*\))(\s*,\s*\(\s*(?<XH>\-?\d+(:?\.\d+)?)\s+(?<YH>\-?\d+(:?\.\d+)?)(?:\s*,\s*\-?\d+(:?\.\d+)?\s+\-?\d+(:?\.\d+)?)*\s*,\s*\k<XH>\s+\k<YH>\s*\))*\s*\)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment