I have the following text
This MUST should be caught, but not this one **MUST** because it is between **
The idea is that I will be running a search/replace on some files, several times, and I would like the replace to be idempotent. This is because some MUST
may have already been changed into **MUST**
and I do not want to end up with ******MUST******
after a few runs.
To do that I tried to build a regex that says "match MUST
but not if it is surrounded by **
":
(?!\(\*\*\))MUST(?!\(\*\*\))
(inspired by another question, regex101 playground).
This however matches both MUST
.