Title: SRE: Atomic Grouping (?>...) is not supported
Type: enhancement Stage: patch review
Components: Library (Lib), Regular Expressions Versions: Python 3.5
Status: open Resolution:
Dependencies: Superseder:
Assigned To: effbot Nosy List: abacabadabacaba, effbot, ezio.melotti, georg.brandl, irdb, rsc, serhiy.storchaka, terry.reedy, timehorse
Priority: low Keywords: patch

Created on 2001-06-14 08:30 by effbot, last changed 2015-03-17 18:35 by abacabadabacaba.

File name Uploaded Description Edit
issue2636-01.patch timehorse, 2008-06-17 17:49
re_atomic_groups.patch serhiy.storchaka, 2014-11-11 20:23 review
Messages (11)
msg53164 - (view) Author: Fredrik Lundh (effbot) * (Python committer) Date: 2001-06-14 08:30
from the jeffrey friedl report:

(?>...) is not supported

[this is a "stand-alone pattern".  the engine has code 
for this, but the parser doesn't recognize this yet.  
shouldn't be too hard to fix; I just need a couple of 
good test cases before I start /F]
msg63284 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2008-03-05 16:17
Also referred to as an atomic group: see for a discussion.

Fredrik, when you say "the engine has code for this", what do you mean?
msg63288 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2008-03-05 16:33
There's also an alternate syntax for this, called possessive
quantifiers: a*+, a++, a{m,n}+.
msg64634 - (view) Author: Jeffrey C. Jacobs (timehorse) Date: 2008-03-28 12:39

If you're still listening, I am gonna try and tackle this one but I 
would like to know why you or the famous Jeffrey of the Regexp world 
claims that there is already code in the Regexp Engine for Atomic 
Grouping?  Adding a hook for (?>...) should be trivial but I don't wanna 
re-invent the wheel if the proper stack-unwind code already exists.  
Thanks.  Of course, Andrew (a.k.a. A.M. Kuchling) already asked this 
question and you did not answer it, so I guess you're not reading this, 
but if you are, please respond.  Thanks!
msg64735 - (view) Author: Jeffrey C. Jacobs (timehorse) Date: 2008-03-29 23:08
I'm digging into the at the moment and this I have all the 
changes I need for that now.  The rest of the changes I believe are in 
either or more likely directly in _sre.c, so I will 
examine those files next.  I am attaching a single diff for 
expedience.  This is not an official patch, just a sample to see the 
progress I am making.  I forgot the correct format for patch files but 
I promise to get it right when I have made more progress.
msg65777 - (view) Author: Jeffrey C. Jacobs (timehorse) Date: 2008-04-25 10:53
Quick update (see thread 2636 for other updates to the Regex
functionality): I do have a design in my mind for how to accomplish both
Atomic Grouping and Possessive Qualifiers and it would work with either
the existing Engine design or the new design I have been playing with. 
It's just a matter of getting around to implementing it, testing it and
documenting it.

I currently am having problem with Bazaar / Launchpad which are beyond
the scope of this issue but are effecting my work.  Those issues can be
found on the Launchpad site if you look for Answers / Bugs originating
from "timehorse".
msg68337 - (view) Author: Jeffrey C. Jacobs (timehorse) Date: 2008-06-17 17:49
I have finished work on the Atomic Grouping / Possessive Qualifiers 
support and am including a patch to achieve this; however, should be consulted for the complete list 
of changes in the works for the Regexp engine.
msg113201 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-08-07 20:53
Does the re2 work (#2636) make this outdated?
msg114621 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-08-22 00:06
Implemented in #2636.
msg231041 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-11-11 19:17
Some unrelated to the topic changes from the patch are committed in 30a6c74ad87f.
msg231049 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-11-11 20:23
Reopened because definitely regex will be not adopted in 3.5.

Here is updated to 3.5 Jeffrey's patch.
Date User Action Args
2015-03-17 18:35:09abacabadabacabasetnosy: + abacabadabacaba
2015-03-02 08:57:59ezio.melottisetnosy: + ezio.melotti
2014-12-31 16:18:38akuchlingsetnosy: - akuchling
2014-12-24 11:57:53irdbsetnosy: + irdb
2014-11-11 20:23:03serhiy.storchakasetstatus: closed -> open
files: + re_atomic_groups.patch
versions: + Python 3.5, - Python 3.2
messages: + msg231049

resolution: duplicate ->
2014-11-11 19:17:05serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg231041
2010-08-22 00:06:24georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg114621

resolution: duplicate
2010-08-07 20:53:30terry.reedysetversions: + Python 3.2, - Python 2.6
nosy: + terry.reedy

messages: + msg113201

stage: patch review
2008-06-17 17:49:20timehorsesetfiles: - PyLibDiffs.txt
2008-06-17 17:49:08timehorsesetfiles: + issue2636-01.patch
keywords: + patch
messages: + msg68337
2008-04-25 10:53:54timehorsesetmessages: + msg65777
2008-04-24 21:06:35rscsetnosy: + rsc
2008-03-29 23:08:52timehorsesetfiles: + PyLibDiffs.txt
messages: + msg64735
components: + Library (Lib)
versions: + Python 2.6
2008-03-28 12:40:52timehorsesettitle: SRE: (?>...) is not supported -> SRE: Atomic Grouping (?>...) is not supported
2008-03-28 12:40:03timehorsesetmessages: + msg64634
2008-03-27 17:25:27timehorsesetnosy: + timehorse
2008-03-05 16:33:40akuchlingsetmessages: + msg63288
2008-03-05 16:17:53akuchlingsetnosy: + akuchling
messages: + msg63284
2001-06-14 08:30:56effbotcreate