in reply to Precompiling substitution regex
my @SUB_REC = ( qr{(?:this|or|that)}si, qr{(?:One|Two|Three)}s, ); my @SUBSTITUTION = qw/bob four/; for my $idx (0..$#SUB_REC) { $str =~ s/$SUB_REC[$idx]/$SUBSTITUTION[$idx]/; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Precompiling substitution regex
by FreakyGreenLeaky (Sexton) on Jun 17, 2011 at 11:57 UTC | |
by moritz (Cardinal) on Jun 17, 2011 at 12:04 UTC | |
by AnomalousMonk (Archbishop) on Jun 17, 2011 at 18:11 UTC |