in reply to Performance optimization question

please ignore this post, and see my post below. sorry for double posting.

I'd probably try a regex only, but I'm not sure it will improve matters. This code assumes /reg exp/ does not match | characters and that $string doesn't start with a |:

my @results = $string =~ /(reg exp)(?:\||$)/g;