note
salva
Let Perl generate the regular expression from a hash containing the list of words and their replacements:
<c>
my %trans = (zero => 0,
one => 1,
two => 2,
three => 3);
my $words_re = join "|", map quotemeta, keys %trans;
$string =~ s/($words_re)/$trans{lc $1}/ig;
</c>
11129290
11129290