... our is our
I think Anonymonk is concerned about the second appearance of our $re within the (??{ our $re }) regex subexpression. Although somewhat unfamiliar, I think this is kosher because our acts as a declaration of a package variable and $re needs to be declared or pre-declared somehow to be referenced within the regex under full strictures. The following variations work identically with strictures (note no capturing groups within $re):
>perl -wMstrict -le "my $s = 'x(y) (a(b)) ()() q (a(b)c()(d(e(f)g))h) q'; ;; our $r3; $r3 = qr{ \( (?: [^()]+ | (??{ $r3 }) )* \) }xms; ;; my @p = $s =~ m{ $r3 }xmsg; print qq{'$_'} for @p; print '--------'; ;; $s =~ m{ ($r3) [^()]* ($r3) }xms; print qq{1 '$1' 2 '$2'}; print '--------'; " '(y)' '(a(b))' '()' '()' '(a(b)c()(d(e(f)g))h)' -------- 1 '(y)' 2 '(a(b))' --------
And the OPed:
our $r3 = qr{ ... (??{ our $r3 }) ... }xms;
In reply to Re^5: Regex's, parentheses, and the mysterious ( ??{ } ) operator
by AnomalousMonk
in thread Regex's, parentheses, and the mysterious ( ??{ } ) operator
by Clovis_Sangrail
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |