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
It would be great if Python's regexps supported recursive
regular expressions, just like PCRE. For that it'd need
its formations (?R), (?<name>) and (?P>name).
The PCRE has some interesting suggestions on how the grammar for a
recursive regular expressions might work. I am concerned about the use of
(?P>name) to call a regexp subexpression as an atomic subroutine. The (?
P>name) format has never before been supported by Python and the (?P...)
notation is exclusive to python, so it is strange the PCRE assigning us a
use for (?P>name) without the Python community actually agreeing to it.
Other than that, though, I think this is a possible feature we could add
in bpo-2636 as item 35.
mrabarnett commented on Oct 13, 2008
mrabarnettmannequin
Mannequin
More actions
Perl (?number) for calling numbered groups and (?&name) for named groups
(Perl also supports (?P>name)). (?R) is equivalent to (?0).
It's interesting that the documentation for both Perl and PCRE say that
they support (?P>name) because that's what Python uses!
pwaller commented on Mar 24, 2009
pwallermannequin
Mannequin
More actions
It looks like Matthew has dropped this feature from consideration.
I've been told that my current patches contain too many differences
from the current implementation, so basically I have to go back to the
start and introduce any changes a little at a time, without knowing
whether any particular change will be accepted.
I think that recursive regular expressions are starting to stray into
the realm of pyparsing and so forth.
So I might not have the time (and I don't think I have the inclination!)
to implement them.
BreamoreBoy commented on Aug 18, 2010
BreamoreBoymannequin
Mannequin
More actions
Closing because of quote from msg83993 "Another feature request that I've decided not to consider any further is recursive regular expressions. There are other tools available for that kind of thing, and I don't want the re module to go the way of Perl 6's rules; such things belong elsewhere, IMHO."
Activity
kamek commentedon Feb 27, 2003
It would be great if Python's regexps supported recursive
regular expressions, just like PCRE. For that it'd need
its formations (?R), (?<name>) and (?P>name).
rhettinger commentedon Jun 28, 2003
Logged In: YES
user_id=80475
This might be a worthwhile addition to Py2.4.
mrabarnett commentedon Sep 30, 2008
I'll have a look at this. No promises, though.
timehorse commentedon Oct 13, 2008
The PCRE has some interesting suggestions on how the grammar for a
recursive regular expressions might work. I am concerned about the use of
(?P>name) to call a regexp subexpression as an atomic subroutine. The (?
P>name) format has never before been supported by Python and the (?P...)
notation is exclusive to python, so it is strange the PCRE assigning us a
use for (?P>name) without the Python community actually agreeing to it.
Other than that, though, I think this is a possible feature we could add
in bpo-2636 as item 35.
mrabarnett commentedon Oct 13, 2008
Perl (?number) for calling numbered groups and (?&name) for named groups
(Perl also supports (?P>name)). (?R) is equivalent to (?0).
It's interesting that the documentation for both Perl and PCRE say that
they support (?P>name) because that's what Python uses!
pwaller commentedon Mar 24, 2009
It looks like Matthew has dropped this feature from consideration.
See msg83993 .
mrabarnett commentedon Mar 24, 2009
There are 2 reasons:
I've been told that my current patches contain too many differences
from the current implementation, so basically I have to go back to the
start and introduce any changes a little at a time, without knowing
whether any particular change will be accepted.
I think that recursive regular expressions are starting to stray into
the realm of pyparsing and so forth.
So I might not have the time (and I don't think I have the inclination!)
to implement them.
BreamoreBoy commentedon Aug 18, 2010
Closing because of quote from msg83993 "Another feature request that I've decided not to consider any further is recursive regular expressions. There are other tools available for that kind of thing, and I don't want the re module to go the way of Perl 6's rules; such things belong elsewhere, IMHO."
bitdancer commentedon Feb 24, 2013
Agreed that this is unlikely to ever get implemented given that Matthew doesn't think it should be.
mrabarnett commentedon Feb 24, 2013
FYI, I did eventually add it to my regex implementation. It was quite challenging!