in reply to how to use "NOT" in regex

Use a zero width negative look-ahead assertion. perlre
/^(?!$word1|$word2).../
Also, you might want to escape the "words" for regex special characters using quotemeta.
/^(?!\Q$word1\E|\Q$word2\E).../