Message321062
| Author | Jan Švec |
|---|---|
| Recipients | Jan Švec, ezio.melotti, mrabarnett |
| Date | 2018-07-04.20:41:58 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1530736918.23.0.56676864532.issue34048@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
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" |
|
| History | |||
|---|---|---|---|
| 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 | |