regex, extract string NOT between two brackets

On refiddle.com set to JavaScript, try using this pattern

/\|(?![^{]*})/g

with this text

word1 | {word2 | word3 } | word 4 | word 4 | {word2 | word3 }

This should match all of the Pipe symbols that are not inside {}.

Leave a Comment