http://www.perlmonks.org?node_id=237539


in reply to Replacing consecutive tokens in 1 pass

Hi ,

my $str = "|90|93|foo|bar|91|92|95|96|906|"; $str =~ s/(?<=\|)9[0-6](?=\|)/X/g; print "[ $str ]\n"; __END__ Also , you can go through this tutorial
Extended Patterns regular expressions