in reply to \g{-2} for inside (?{ ... })

The following appears to work:

(?<x> ( . . ) (?{ '...' }) ) (?<y> ( . . ) (?{ print("(", join(',', split(//,$^N)), ")") }) ) (?<z> ( . . ) (?{ '...' }) )
but I suspect that is finessing the problem you're really interested in.

I'd really love to know what on earth this is doing, and why !

Replies are listed 'Best First'.
Re^2: \g{-2} for inside (?{ ... })
by ikegami (Patriarch) on Nov 06, 2008 at 12:32 UTC

    Playing with regexp as parsers. See An adventure with 5.10 regular expressions.

    The series of ( . ) represent a series arbitrarily complex grammar rules. I need to know what each rule matched.

    Update: As I write this, it strikes me that what I want is not necessarily what those rules matched, so my question is moot.