in reply to Orthography Translation using Regex
my $translation_table = { 'A' => 'A', # translate from => to 'a' => 'a', 'r' => 'r', # etc }; my $str = "Barra O Gri obhtha"; # build search pattern as 'pattern1|pattern2|...' my $patterns = join '|', keys %$translation_table; $str =~ s/($patterns)/$translation_table->{$1}/ge;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Orthography Translation using Regex
by ysth (Canon) on Feb 29, 2004 at 20:57 UTC | |
by Roger (Parson) on Feb 29, 2004 at 21:04 UTC |