[issue41664] re.sub does NOT substitute all the matching patterns when re.IGNORECASE is used

Matthew Barnett report at bugs.python.org
Sat Aug 29 18:32:24 EDT 2020


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

The 4th argument of re.sub is 'count', not 'flags'.

re.IGNORECASE has the numeric value of 2, so:

    re.sub(r'[aeiou]', '#', 'all is fair in love and war', re.IGNORECASE)

is equivalent to:

    re.sub(r'[aeiou]', '#', 'all is fair in love and war', count=2)

----------
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41664>
_______________________________________


More information about the Python-bugs-list mailing list