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 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:58Jan Švecsetrecipients: + Jan Švec, ezio.melotti, mrabarnett
2018-07-04 20:41:58Jan Švecsetmessageid: <1530736918.23.0.56676864532.issue34048@psf.upfronthosting.co.za>
2018-07-04 20:41:58Jan Šveclinkissue34048 messages
2018-07-04 20:41:58Jan Šveccreate