in reply to Composing regex's dynamically
An alternative would be to construct the final regex from the parts:
my @parts = qr/this-stuff/; if ($foo_needed) { push @parts, qr/more-stuff/i; }; my $r = join "|", @parts; $r = qr/$r/; # just to be explicit about what the string is supposed t +o contain
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Composing regex's dynamically
by John M. Dlugosz (Monsignor) on Apr 27, 2011 at 13:48 UTC | |
by Corion (Patriarch) on Apr 27, 2011 at 13:52 UTC | |
by John M. Dlugosz (Monsignor) on Apr 27, 2011 at 15:41 UTC | |
by Corion (Patriarch) on Apr 27, 2011 at 16:05 UTC | |
by John M. Dlugosz (Monsignor) on Apr 28, 2011 at 08:15 UTC | |
|