-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
re.sub() bug with IGNORECASE #72038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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. |
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. |
Thanks! That helps. I apologize for raising a non-existent issue. On Wed, Aug 24, 2016 at 11:59 AM, R. David Murray <[email protected]>
|
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: