Issue 3482: re.split, re.sub and re.subn should support flags (original) (raw)

Created on 2008-08-01 07:20 by benoit, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg70543 - (view) Author: Benoit T (benoit) Date: 2008-08-01 07:20
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.
msg71166 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-08-15 10:16
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.
msg113637 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2010-08-11 22:22
This request seems reasonable.
msg118611 - (view) Author: Matt Keeler (mjkeeler7) Date: 2010-10-14 02:26
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.
msg118912 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-10-17 03:17
For reference, the py3k rev was r70091.
History
Date User Action Args
2022-04-11 14:56:37 admin set github: 47732
2010-10-17 03:17:26 r.david.murray set status: open -> closednosy: + r.david.murraymessages: + resolution: acceptedstage: needs patch -> resolved
2010-10-14 02:26:04 mjkeeler7 set nosy: + mjkeeler7messages: +
2010-08-12 11:34:29 pitrou set stage: test needed -> needs patch
2010-08-11 22:22:37 rhettinger set keywords: + easynosy: + rhettingermessages: +
2010-08-09 03:10:51 terry.reedy set stage: test neededversions: + Python 3.2, - Python 3.1, Python 2.7
2008-09-27 14:25:42 timehorse set versions: + Python 3.1, Python 2.7, - Python 2.6, Python 3.0
2008-09-27 14:23:14 timehorse set nosy: + timehorse
2008-08-15 10:16:46 pitrou set priority: normaltype: behavior -> enhancementmessages: + nosy: + pitrouversions: + Python 2.6, Python 3.0
2008-08-01 07:20:37 benoit set type: behaviorcomponents: + Regular Expressions
2008-08-01 07:20:21 benoit create