One reason (maybe the only reason) that the stringization of a qr// object comes wrapped in its own little non-capturing group is so that the further interpolation of something like
can work intuitively — even the $rz{2,5} bit, surprisingly, although you can only push that one so far.my $rx = qr{ ... }xms; my $ry = qr{ ... }xms; my $rz = qr{ ... }xms; if ($string =~ m{ \A $rx* $ry+ $rz{2,5} \z }xms) { ... }
This node notwithstanding, what would one gain in the long run from a "simplified" form for the example given? How often does one build a regex in this way and then try to read it?
Give a man a fish: <%-{-{-{-<
In reply to Re: Tidying and simplifying a regular expression
by AnomalousMonk
in thread Tidying and simplifying a regular expression
by Dallaylaen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |