Message321062
re.sub() is behaving incorrectly, if re.IGNORECASE is used. Tested on 2.7, 3.4 and 3.6. The code follows:
import re
def subst(text):
text = re.sub(r"\bnine\b", "niner", text, re.IGNORECASE)
return text
print(subst("nine nine nine nine"))
It prints "niner niner nine nine". Without the re.IGNORECASE, the output is correct: "niner niner niner niner" |
|
Date |
User |
Action |
Args |
2018-07-04 20:41:58 | Jan Švec | set | recipients:
+ Jan Švec, ezio.melotti, mrabarnett |
2018-07-04 20:41:58 | Jan Švec | set | messageid: <1530736918.23.0.56676864532.issue34048@psf.upfronthosting.co.za> |
2018-07-04 20:41:58 | Jan Švec | link | issue34048 messages |
2018-07-04 20:41:58 | Jan Švec | create | |
|