You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
re.split, re.sub and re.subn should support flags #47732
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:
assignee=Noneclosed_at=<Date2010-10-17.03:17:26.107>created_at=<Date2008-08-01.07:20:21.211>labels= ['expert-regex', 'easy', 'type-feature']
title='re.split, re.sub and re.subn should support flags'updated_at=<Date2010-10-17.03:17:26.047>user='https://bugs.python.org/benoit'
Given that the search operations support flags, it seems natural for a
developer that the other functions in the module support flags as well.
So when running "re.split(pattern, string, re.I)", the split() command
seems to not work and don't return a message error (I understand that
're.I' is understood as 'maxsplit=0'.)
This is confusing and I think that it should be changed so that all
functions in the module are consistent.
Please note that the flags can be inlined in the pattern instead. That
is, you can begin the pattern with "(?i)" instead of passing re.I in the
flags parameter.
Python 2.7 docs say this was added in 2.7.3.1
Python 3.1 docs say this was added in 3.1
The problem with calling 're.split(pattern, string, re.I)' is that you are using positional arguments only. If you were to do 're.split(pattern, string, flags=re.I)', that should produce the desired result.
Activity
benoit commentedon Aug 1, 2008
Given that the search operations support flags, it seems natural for a
developer that the other functions in the module support flags as well.
So when running "re.split(pattern, string, re.I)", the split() command
seems to not work and don't return a message error (I understand that
're.I' is understood as 'maxsplit=0'.)
This is confusing and I think that it should be changed so that all
functions in the module are consistent.
pitrou commentedon Aug 15, 2008
Please note that the flags can be inlined in the pattern instead. That
is, you can begin the pattern with "(?i)" instead of passing re.I in the
flags parameter.
rhettinger commentedon Aug 11, 2010
This request seems reasonable.
mjkeeler7 commentedon Oct 14, 2010
Python 2.7 docs say this was added in 2.7.3.1
Python 3.1 docs say this was added in 3.1
The problem with calling 're.split(pattern, string, re.I)' is that you are using positional arguments only. If you were to do 're.split(pattern, string, flags=re.I)', that should produce the desired result.
bitdancer commentedon Oct 17, 2010
For reference, the py3k rev was r70091.