in reply to String regex replacement
my %replacement = ( 500 => '000', 988 => '000', 1210 => '1000', 1300 => '1000', 2134 => '2000, 2500 => '2000', ); my $regex = join '|', keys %replacement; $str =~ s/\b($regex)\b/$replacment{$1}/;
Untested, but it should work pretty much like this.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: String regex replacement
by Skeeve (Parson) on Feb 24, 2014 at 12:02 UTC | |
|
Re^2: String regex replacement
by FloydATC (Deacon) on Feb 26, 2014 at 07:27 UTC | |
by hdb (Monsignor) on Feb 26, 2014 at 07:58 UTC |