$content =~ s{(foo.*?bar)}{ my $s = $1; $s =~ s{\Q$orig_zimzam\E}{$rep_zimzam}; $s; }sge;