I have a long string:
(Today is a blue day) (Today is a good day) (Today is a BAD day) (Today is a green day) (Today is a blue day)
I want to match the parentheses groups, except if it contains the capitalized word. The word will always be fully capitalized, but may not be the only fully capitalized word - but will be the only word that is exactly BAD.
I have a very long string and I want to change the parentheses groups that do not contain the word BAD while leaving BAD alone. I was hoping to avoid iterating over every single parentheses group to check if it contains BAD.
This: \(.+?\)
Will match my parentheses groups.
I have tried:
\(.+?(?=\bBAD\b).+?\) - this matches every group up to the group containing BAD.
(?=\bBAD\b).+?\) - this matches the end of the group "BAD day)"
I tried a few variations of negative lookbehinds but could not get them to provide a result.
I know this works:
\(.[^BAD]+?\)
Until you include (Today is a Blue day) - and then it fails.
Anyone know an effective way to do this?