javascript regular expression to not match a word
if (!s.match(/abc|def/g)) {
alert("match");
}
else {
alert("no match");
}
This is what you are looking for:
^((?!(abc|def)).)*$
The ?!
part is called a negative lookahead assertion. It means "not followed by".
The explanation is here: Regular expression to match a line that doesn't contain a word