in reply to Regex Backtracking
What is happening is as it stands the regular expression is evaluating two characters at a time.Whereas the frame for the matches should be one character. A sloppy fix would be:
To make regexes easier to read try using the debug pragma:
To get insight into how the regexes do what they do ;)
while (<DATA>) { $i=0 while s/\|\|/\| \|/g; # repeats as many times as is necessary print; }As joost rightly says the forward lookahead operation is probably the best way to go.
To make regexes easier to read try using the debug pragma:
use re 'debugcolor'
To get insight into how the regexes do what they do ;)
I'd love to find a solution using the 'c' modifier .. but then I'm not Abigail
--
Brother Frankus.
¤
In Section
Seekers of Perl Wisdom