Issue 27851: re.sub() bug with IGNORECASE (original) (raw)
Working with re.sub() noted strange behavior with re.I set, seems like a bug. Noted in both Python 2.7.12 and Python 3.5.2, Anaconda custom build (32-bit) on Windows 7.
import re re.sub('.', '', '.....') '' re.sub('.', '', '.....', re.I) '...' re.sub('.', '', '.....', re.L) '.'
The first case is the expected behavior, the second and third aren't. Oddly enough,
re.sub('.', '', '.....', re.L | re.I) ''
MWE file attached (python3)
Thanks, I'm a heavy python user, but not all that advanced - hope this is helpful and I'm not just being stupid.
Thanks! That helps. I apologize for raising a non-existent issue. Dan
On Wed, Aug 24, 2016 at 11:59 AM, R. David Murray <report@bugs.python.org> wrote:
R. David Murray added the comment:
I really wish we could "fix" this somehow, since we get an issue opened for it probably every two or three months.
The fourth argument to re.sub is the count, not the flags.
nosy: +r.david.murray resolution: -> not a bug stage: -> resolved status: open -> closed
Python tracker <report@bugs.python.org> <https://bugs.python.org/issue27851>