my $what = join('|', map(quotemeta, keys %fixers)) ; $$text_ref =~ s!(?<="http://)($what)(?=["/])!$fixers{$1}!ge ;