I'm trying to match a pattern except when the match appears in between double square brackets.
The pattern I'm trying to match is \|, i.e. the | character.
Example:
Val 1 | Val 2 | Val3
This will return 2 matches. However, I want to skip | char if it is inside [[...]]. Example:
Val 1 | [[ | ]] | Val 3
Here I do not want the | char inside [[ ]] to be returned.Therefore this should return 2 matches.
I tried negative lookhead but my regex doesn't seem to work.
I captured [[ | ]] using \[\[.*\|.*\]\]:
[^(\[\[.*\|.*\]\])]
(?!(\[\[.*\|.*\]\]))
Those don't seem to give me the desired result.