I have found countless 'match anything except for' examples, but not any for what I want.
I do not want to match "anything" [except for x]!
I want to match "This is a line" but not if the string 'do not' is present. therefore, only line B should contain a match
(A) This is nonsense and none of this should match
(B) This is a line and we want part of it to be matched
(C) This is a line and we do not want anything to be matched
(D) This is nonsense and none of this should match
Can someone please explain how to do this? Are capture groups absolutely necessary? I'm not trying to capture anything but I'll definitely use it if I have to.
I've played around on https://regex101.com/ but I am not getting anywhere. The assistance of regex veterans is greatly appreciated.