in reply to Tidying and simplifying a regular expression
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: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Tidying and simplifying a regular expression (flags)
by LanX (Saint) on Dec 10, 2017 at 02:13 UTC | |
by AnomalousMonk (Archbishop) on Dec 10, 2017 at 05:02 UTC | |
by LanX (Saint) on Dec 10, 2017 at 22:22 UTC | |
|
Re^2: Tidying and simplifying a regular expression
by Dallaylaen (Chaplain) on Dec 09, 2017 at 07:48 UTC | |
by LanX (Saint) on Dec 09, 2017 at 14:41 UTC |