Message 68910 - Python tracker (original) (raw)
In my particular case, we were passing the regex on to a database which has regex support syntactically equal to Python, so it seemed natural to use re.escape to make sure we weren't matching against the pattern we really wanted.
The documentation of re.escape also states that it will only escape non- alphanumeric characters, which is apparently only true if you are using a single byte encoding (ie. not utf-8, or any other encoding using more than a single byte per character). At the very least, that's probably worth mentioning in the docs.