A stringized regex object is wrapped in a non-capturing grouping that preserves the regex modifiers in effect when the regex was compiled. This allows a regex object to be unaffected by the modifiers in effect in any enclosing regex 'scope' during interpolation within another regex or regex object. Consider:
See also the discussion of "(?^aluimsx:pattern)" in the Extended Patterns section of perlre.c:\@Work\Perl>perl -wMstrict -le "my $rx = qr/(?^xms:^data_123$)/; print $rx; ;; my $ry = qr/^data_123$/xms; print $ry; ;; my $rz = qr{ T $rx U $ry V }xms; print $rz; " (?^:(?^xms:^data_123$)) (?^msx:^data_123$) (?^msx: T (?^:(?^xms:^data_123$)) U (?^msx:^data_123$) V )
In reply to Re^5: Compiled regular expression using qr
by AnomalousMonk
in thread Compiled regular expression using qr
by perlbaski
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |