Message292093
Yes, the second argument is a replacement template, not a literal.
This issue does point out a different problem, though: re.escape will add backslashes that will then be treated as literals in the template, for example:
>>> re.sub(r'a', re.escape('(A)'), 'a')
'\\(A\\)'
re.escape doesn't always help.
The solution here is to pass a replacement function instead:
>>> re.sub(r'a', lambda m: '(A)', 'a')
'(A)' |
|
Date |
User |
Action |
Args |
2017-04-22 01:17:58 | mrabarnett | set | recipients:
+ mrabarnett, ezio.melotti, r.david.murray, Patrick Foley |
2017-04-22 01:17:58 | mrabarnett | set | messageid: <1492823878.85.0.370150986412.issue30133@psf.upfronthosting.co.za> |
2017-04-22 01:17:58 | mrabarnett | link | issue30133 messages |
2017-04-22 01:17:58 | mrabarnett | create | |
|