in reply to look behind in REs
My guess is that it's a little slow, though. I'd reverse $string first, myself.my $string = "AAbfwercB(A)fjklASZaB(A)xvASABAB(A)gfdaZAA"; my @chunks = split(/B\(A\)/, $_); $_ =~ tr/A/Z/ foreach @chunks; $string = join 'B(A)', @chunks;
|
|---|