[issue11947] re.IGNORECASE does not match literal "_" (underscore)

Matthew Barnett report at bugs.python.org
Thu Apr 28 21:54:49 CEST 2011


Matthew Barnett <python at mrabarnett.plus.com> added the comment:

help(re.sub) says:

    sub(pattern, repl, string, count=0)

and re.IGNORECASE has a value of 2.

Therefore this:

    re.sub("_", "X", subject, re.IGNORECASE)

is telling it to replace at most 2 occurrences of "_".

----------
nosy: +mrabarnett

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11947>
_______________________________________


More information about the Python-bugs-list mailing list