Regular expression to match a line that doesn’t contain a word
^((?!yourstring).)*$
^
the beginning of the string, (
group and capture to \1 (0 or more times (matching the most amount possible)),(?!
look ahead to see if there is not, your string,)
end of look-ahead, .
any character except \n,)*
end of \1 (Note: because you are using a quantifier on this capture, only the LAST repetition of the captured pattern will be stored in \1)$
before an optional \n, and the end of the string.
Source: StackOverflow