mirror of https://github.com/sgoudham/Enso-Bot.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
677 B
Python
14 lines
677 B
Python
5 years ago
|
import re
|
||
|
|
||
|
# Regular expression for recognizing HEXEWKB and WKT. A prophylactic measure
|
||
|
# to prevent potentially malicious input from reaching the underlying C
|
||
|
# library. Not a substitute for good Web security programming practices.
|
||
|
hex_regex = re.compile(r'^[0-9A-F]+$', re.I)
|
||
|
wkt_regex = re.compile(r'^(SRID=(?P<srid>\-?\d+);)?'
|
||
|
r'(?P<wkt>'
|
||
|
r'(?P<type>POINT|LINESTRING|LINEARRING|POLYGON|MULTIPOINT|'
|
||
|
r'MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION)'
|
||
|
r'[ACEGIMLONPSRUTYZ\d,\.\-\+\(\) ]+)$',
|
||
|
re.I)
|
||
|
json_regex = re.compile(r'^(\s+)?\{.*}(\s+)?$', re.DOTALL)
|