Here is my scenario:
If the text contains dirty or rotten in any position, no matches should be found regardless of matching patterns.
If the text without dirty or rotten contains either red, greed, or yellow followed by apple, pear or peach it would be a match.
Here is what I have tried:
(?:.+(?:[^(dirty)|(rotten)].{1,30}))(?:green|red|yellow).(?:apple|peach|pear)(?:(?!(dirty|rotten))(?:$))
These should match: I have an green apple I have a yellow peach I have red and green apples
These should not: I have a dirty red apple I have a green peach that is dirty I have a yellow dirty apple