Issue #27 resolved
Former user created an issue

In order to parse certain strings belonging to certain kinds of languages, recursive patterns for recursive matching are necessary. For example, if you want to parse and capture a parenthesized chunk of text which may contain nested parenthesis, you'll need to have recursion.

Perl already supports recursive matching, so does PCRE and with that many libraries for languages such as PHP. I always wondered why the Python regex engines never did.

Please refer to http://perldoc.perl.org/perlre.html for documentation on the widely accepted syntax for recursive patterns.

Comments (2)

  1. Anonymous

    Please could you provide a set of tests, checking what the groups should match, including the expected results of the matched.captures() method. Try to make them short but thorough.

    Note that Perl allows backtracking into the recursive part, whereas PCRE doesn't (it treats the recursive part as atomic).

    I'm aiming for the Perl behaviour.

  2. Log in to comment