use strict; use locale; my $string = "_'nada_komo_el_'sol_"; $string =~ s/(_)([^'])/$1'$2/g; print $string; __END__ _'nada_'komo_'el_'sol_ #### $string =~ s/(_)[^']/$1'/g;