[issue13409] Invalid expression error if a regex ends with a backslash

2011-11-15 Thread Ezio Melotti
Ezio Melotti added the comment: You either have to double escape it (once for python and then for the regex engine) or use raw strings: >>> re.match("", '\\').group() '\\' >>> re.match(r"\\", '\\').group() '\\' -- assignee: -> ezio.melotti resolution: -> invalid stage: -> commit

[issue13409] Invalid expression error if a regex ends with a backslash

2011-11-15 Thread Michał Leśniewski
New submission from Michał Leśniewski : If a regular expression ends with a backslash, an exception is raised. Of course, the backslash has to be escaped. The simplest example, that causes the error is a regular expression, that should match only a single backslash: import re r = re.co