This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: SRE: (?flag) isn't properly scoped
Type: enhancement Stage:
Components: Regular Expressions Versions: Python 3.2
Status: closed Resolution: out of date
Dependencies: 3825 Superseder: Adding a new regex module (compatible with re)
View: 2636
Assigned To: effbot Nosy List: belopolsky, effbot, georg.brandl, mrabarnett, rsc, serhiy.storchaka, timehorse
Priority: low Keywords:

Created on 2001-06-14 08:26 by effbot, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Messages (5)
msg53160 - (view) Author: Fredrik Lundh (effbot) * (Python committer) Date: 2001-06-14 08:26
from the jeffrey friedl report:

The way (?i) works now is that if it appears anywhere 
in the regex, it turns on case-insensative matching 
for the entire regex. This is different (and less 
useful) than how Perl or Sun's Java package does it

[I'm pretty sure SRE does it this way to exactly
match the version of PCRE used in 1.5.2, but maybe
it's time to move forward... /F]
msg63644 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2008-03-17 14:01
This is still a valid issue. (As of Python 2.6a1+ (trunk:61434, Mar 17 
2008, 08:06:54).)

>>> bool(re.match("abc(?i)","AbC"))

The documentation says that the behavior of a regex with (?<letter>) not 
at the beginning is undefined.

Short of implementing Java/Perl behavior, this should be made an error 
rather than undefined so that users porting their code from Java/Perl 
get an early warning.
msg73685 - (view) Author: Matthew Barnett (mrabarnett) * (Python triager) Date: 2008-09-24 00:38
Implemenetd in #3825.
msg114617 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-08-22 00:03
I don't think this should be changed anymore, at least not without a flag.  Anyway, it is implemented in #2636.
msg230851 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-11-08 12:27
See also issue22493.
Date User Action Args
2022-04-10 16:04:07adminsetgithub: 34623
2014-11-08 12:27:50serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg230851
2010-08-22 00:03:21georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg114617

superseder: Major reworking of Python 2.5.2 re module -> Adding a new regex module (compatible with re)
2010-08-07 21:00:30terry.reedysetresolution: out of date
superseder: Major reworking of Python 2.5.2 re module
versions: + Python 3.2, - Python 2.6
2009-02-12 19:35:13ajaksu2setdependencies: + Major reworking of Python 2.5.2 re module
versions: + Python 2.6
2008-09-24 11:28:31timehorsesetnosy: + timehorse
2008-09-24 00:38:24mrabarnettsetnosy: + mrabarnett
messages: + msg73685
2008-04-24 21:12:50rscsetnosy: + rsc
2008-03-17 14:01:51belopolskysetnosy: + belopolsky
messages: + msg63644
2001-06-14 08:26:00effbotcreate