Message168909
[Copying post I made here: http://stackoverflow.com/questions/12082886/bug-in-python-regex-re-sub-with-re-multiline]
I'm noticing some odd behavior in Python's Regex library, and I'm not sure if I'm doing something wrong.
If I run a regex on it using re.sub(), with re.MULTILINE. It seems to only replace the first few occurrences. It replaces all occurrences if I turn off re.MULTILINE, use re.subn(..., count = 0, flags = re.MULTILINE), or compile the regex using re.compile(..., re.MULTILINE).
I am running Python 2.7 on Ubuntu 12.04.
I've posted a random example on:
http://pastebin.com/49SU8Mm2 - Output from terminal
http://codepad.org/2RO2iS4O - Script, confirming behavior (except for re.subn(), which is different on 2.5) |
|
Date |
User |
Action |
Args |
2012-08-23 00:03:05 | eacousineau | set | recipients:
+ eacousineau, ezio.melotti, mrabarnett |
2012-08-23 00:03:05 | eacousineau | set | messageid: <1345680185.37.0.726682909185.issue15768@psf.upfronthosting.co.za> |
2012-08-23 00:03:04 | eacousineau | link | issue15768 messages |
2012-08-23 00:03:04 | eacousineau | create | |
|