in reply to Regex Backtracking

I'm not a guru or anything close to super knowledgable when it comes to Perl. But, wouldn't changing ... s/\|\|/\| \|/g; to s/\|/\| /g; achieve the desired results? Well sort of. Except for the space in front of the blue, red, and green.