Recursive regexps?

Magnus Lie Hetland mlh at
Fri Nov 19 22:44:56 CET 2004


I've been looking at ways of dealing with nested structures in regexps
(becuase I figured that would be faster than the Python parsing code
I've currently got) and came across a few interesting things...

First there is this, mentioning the (?<DEPTH>) and (?<-DEPTH>)
constructs of the .NET regexp matcher:

Then there was some documentation on PCRE, mentioning (among other
things) The (?R) construct, which (as far as I can tell) matches the
pattern recursively):

It seems that this functionality was introduced in Perl 5.6.

Is this (or something similar) something that would be realistic to
get in the re module? I know I would find it very useful...

Magnus Lie Hetland       Fallen flower I see / Returning to its branch       Ah! a butterfly.           [Arakida Moritake]

More information about the Python-list mailing list