C
Clint O
Maybe this is a bug, maybe not. I am using the named capture buffers
to reduce bugs as I change grouping of my regular expressions over
time. In a lexical analysis application, I'm using it over a series
of alternations.
my $re = qr/ (?<ALT1>pattern) | (?<ALT2>pattern) | ...
One of the alternations happens to be nested:
my $foo = qr{
(?<CODEBEGIN>
\{
(?<CODE>
(?:
(?> [^{}\n]+ ) # Non-parens without
backtracking
|
(?&CODEBEGIN) # Recurse to start of
pattern
)*
)
\}
)
}x;
However, when I ask for the keys of %+, I only get back CODEBEGIN yet
the CODE capture is there when I ask for it. My hope was to use the
keys to determine what I matched so I didn't have to do a series of
tests on %+, but apparently I will have to continue doing this since
this method won't work.
This is Perl 5.10.0.
Thanks,
-Clint
to reduce bugs as I change grouping of my regular expressions over
time. In a lexical analysis application, I'm using it over a series
of alternations.
my $re = qr/ (?<ALT1>pattern) | (?<ALT2>pattern) | ...
One of the alternations happens to be nested:
my $foo = qr{
(?<CODEBEGIN>
\{
(?<CODE>
(?:
(?> [^{}\n]+ ) # Non-parens without
backtracking
|
(?&CODEBEGIN) # Recurse to start of
pattern
)*
)
\}
)
}x;
However, when I ask for the keys of %+, I only get back CODEBEGIN yet
the CODE capture is there when I ask for it. My hope was to use the
keys to determine what I matched so I didn't have to do a series of
tests on %+, but apparently I will have to continue doing this since
this method won't work.
This is Perl 5.10.0.
Thanks,
-Clint