/( #A nice simple capture, for [^|\{]+ #a block of nonsignificant chars | \{ [^}]+ \} #or a bracketed block ) \| #followed by a pipe. /x