I have this regex, it matches a certain word if a list of word are not found:
(?<![Yy]ellow |[Bb]lue |[Rr]ed |[Pp]urple |[Bb]lack )[Cc]olor
It works, but I get the Regex Expression Error: "look-behind requires fixed-width pattern".
I do not have access to the python code.
I tried delimiting by (?:^ and |$) as I saw in a similar question but it didn’t work.
I also found this answer that I think solves the problem but I don’t understand how to make it work in my case.
Test HERE
Dark Color #match
light color #match
Blue Color
red color
that is a blue color and theme
opaque color #match
purple color
>Solution :
You can split up the alternatives in the lookbehind with separated loopbehind assertions if you want a match only:
(?<![Yy]ellow )(?<![Bb]lue )(?<![Rr]ed )(?<![Pp]urple )(?<![Bb]lack )[Cc]olor
See a regex demo
If you have no control over the Python code, you might check if matching what you don’t want and returning a capture group for what you do want also works:
(?:[Yy]ellow |[Bb]lue |[Rr]ed |[Pp]urple |[Bb]lack )[Cc]olor|([Cc]olor)