aarestad has asked for the wisdom of the Perl Monks concerning the following question:
|90|93|foo|bar|91|92|95|96|906|
What I want to do is replace every instance of |9[0-6]| with |X|. Unfortunately, when I specify
s{\|9[0-6]\|}{|X|}g
the above line turns into
|X|93|foo|bar|X|92|X|96|906|
In other words, if I get two in a row, then only the first is replaced. I suppose this is because the pattern matcher picks up on the next character after the replacement, so it wouldn't match. A second pass would take care of the rest, but I'd like a way to do it in one pass, if only for my peace of mind. Any ideas?
|
---|