John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:

In Apocalypse 5, Larry writes,
Difficult to use nested patterns
For many of the reasons we've mentioned, it's difficult to make regexes refer to each other, and even if you do, it's almost impossible to get the nested information back out of them. And there are entire classes of parsing problems that are not solvable without recursive definitions.
He said “almost impossible”.

So, how would you do it?

—John

Title edit by tye

  • Comment on Nested Regular Expressions: =Almost= Impossible?

Replies are listed 'Best First'.
Re: =Almost= Impossible?
by Abigail-II (Bishop) on Dec 13, 2002 at 16:29 UTC
    (?{ }) and $^N.

    Abigail

      Hmm, so you could return a listref from the (?{ call, and thus have all the captures of interest passed out? Then use (?{{ to refer to them as $$^Nn ?