I’m trying to write a regular expression to match anything that isn’t “foo” and “bar”. I found how to match anything but one word at Regular expression to match a line that doesn't contain a word? but I’m not very skilled with regex and am unsure of how to add a second word to this critera.
Any help would be most appreciated!
CLARIFICATION:
I wanted to match on anything that wasn’t EXACTLY foo or bar.
Answer to the question: “A Regular Expression to match anything that isn’t “foo” and “bar”?”
would do exactly that.
You might need to set
RegexOptions.Singlelineif your string can contain newlines that you also wish to match.