regex - How to write Regular Expression in perl with generic way -


i have written code as:

$body =~ s/í/Í/g;     $body =~ s/ó/Ó/g;     $body =~ s/ú/Ú/g;    $body =~ s/ý/Ý/g; 

but not way.

could please provide generic solution?

this solved problem phrased:

use html::entities qw(decode_entities); $unescaped_body = decode_entities($escaped_body); 

if want arbitrary pairs of in , out, should set hash.

my %remap = (    red   => "rojo",    white => "blanco",    blue  => "azul", );  while (my($from, $to) = each %remap) {     $text =~ s/\q$from/$to/g; } 

but slow; there better ways of doing it, aren't ready them yet.


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -