This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Patrick Foley
Recipients Patrick Foley, ezio.melotti, mrabarnett
Date 2017-04-21.21:18:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1492809485.52.0.0203844135424.issue30133@psf.upfronthosting.co.za>
In-reply-to
Content
The following code demonstrates:

import re
text = 'ab\\'
exp = re.compile('a')
print(re.sub(exp, text, ''))

If you remove the backslash(es), the code runs fine.

This appears to be specific to the re module and only to strings that end in (even properly escaped) backslashes. You could easily receive raw data like this from freehand input sources so it would be nice not to have to remove trailing backslashes before running a regular expression.
History
Date User Action Args
2017-04-21 21:18:05Patrick Foleysetrecipients: + Patrick Foley, ezio.melotti, mrabarnett
2017-04-21 21:18:05Patrick Foleysetmessageid: <1492809485.52.0.0203844135424.issue30133@psf.upfronthosting.co.za>
2017-04-21 21:18:05Patrick Foleylinkissue30133 messages
2017-04-21 21:18:05Patrick Foleycreate