my $string = "Sometimes there are extra effects you didn't foresee when using a regex."; while($string=~ m/reg(ex)/) { $string=~ s/$1/ister/; } print $string;