To match any "word" that is a combination of letters, digits or underscores (including any other word chars defined in the \w shorthand character class), you may use word boundaries like in
\b(?!(?:word1|word2|word3)\b)\w+
If the "word" is a chunk of non-whitespace characters with start/end of string or whitespace on both ends use whitespace boundaries like in
(?<!\S)(?!(?:word1|word2|word3)(?!\S))\S+
Here, the two expressions will look like
\b(?!(?:and|not|or)\b)\w+
(?<!\S)(?!(?:and|not|or)(?!\S))\S+
See the regex demo (or, a popular regex101 demo, but please note that PCRE \w meaning is different from the .NET \w meaning.)
Pattern explanation
- \b- word boundary
- (?<!\S)- a negative lookbehind that matches a location that is not immediately preceded with a character other than whitespace, it requires a start of string position or a whitespace char to be right before the current location
- (?!(?:word1|word2|word3)\b)- a negative lookahead that fails the match if, immediately to the right of the current location, there is- word1,- word2or- word3char sequences followed with a word boundary (or, if- (?!\S)whitespace right-hand boundary is used, there must be a whitespace or end of string immediately to the right of the current location)
- \w+- 1+ word chars
- \S+- 1+ chars other than whitespace
In C#, and any other programming language, you may build the pattern dynamically, by joining array/list items with a pipe character, see the demo below:
var exceptions = new[] { "and", "not", "or" };
var result = Regex.Replace("This and This not That", 
        $@"\b(?!(?:{string.Join("|", exceptions)})\b)\w+",
        "\"$&\"");
Console.WriteLine(result); // => "This" and "This" not "That"
If your "words" may contain special characters, the whitespace boundaries approach is more suitable, and make sure to escape the "words" with, say, exceptions.Select(Regex.Escape):
var pattern = $@"(?<!\S)(?!(?:{string.Join("|", exceptions.Select(Regex.Escape))})(?!\S))\S+";
NOTE: If there are too many words to search for, it might be a better idea to build a regex trie out of them.