New submission from Dan Wilt:

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.

----------
components: Regular Expressions
files: re_bug.py
messages: 273575
nosy: Dan Wilt, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: re.sub() bug with IGNORECASE
type: behavior
versions: Python 2.7, Python 3.5
Added file: https://bugs.python.org/file44212/re_bug.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue27851>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to