RegEx is not a hobbyhorse of mine, which is why I regularly struggle with it. So far, I have always found a solution myself, but this is where I fail:
I want matching all "\-" except inside square brackets and brackets following square brackets.
\- match \- all \-
[\- match \- none \-]
[\- match \- none \-](\- match \- none \-)
(\- match \- all \-)
After hours of searching and trying around with uncounted variations of "lookaheads" and "lookbehinds" I am unable to achieve the wanted result.
My best attempt but with unexpected result is
\\\-(?!(([^\[]*])|(?!\]\()*?\)))
I have no idea how to exclude "](…)" without excluding "(…)", too. All attempts around that lead to the effect, inexplicable to me, that depending on the position, instead of none, some hits occur.
Maybe my approach is completely wrong, and I got stuck in it. Either way, I would appreciate a tip.
The "\-" is only one as a sample from a set of meta signs I want to modify.