in reply to Re^2: \g{-2} for inside (?{ ... })
in thread \g{-2} for inside (?{ ... })

and mighty long names

Can't you just use 'x' and 'y' over and over? Doesn't %+ give you the most-recently matched instance matching the given name?

- tye        

Replies are listed 'Best First'.
Re^4: \g{-2} for inside (?{ ... }) (repeat)
by ikegami (Patriarch) on Nov 07, 2008 at 03:18 UTC

    Indeed! I misunderstood the documentation.

    use 5.010; # re features use strict; use warnings; for ('abcdef') { m{ (?(DEFINE) (?<x> (?<i1> . ) (?<i2> . ) (?{ '...' }) ) (?<y> (?<i1> . ) (?<i2> . ) (?{ print("($+{i1},$+{i2})") }) ) (?<z> (?<i1> . ) (?<i2> . ) (?{ '...' }) ) ) (?&y)+ }x; } print("\n");