I'd like to select a lines with does not contain a word SCREEN. I tried the following regex (?<!SCREEN).+
but it seems not to work - selects all the lines. Why doesn't it work?
2 Answers
The short answer: ^((?!SCREEN).)*$
This is inspired by https://stackoverflow.com/questions/406230/regular-expression-to-match-a-line-that-doesnt-contain-a-word which contains a full explanation
-
3
Another try for this case: (SCREEN){0}.*$
Hope that can help.
-
7This still matches lines with "SCREEN" too. regex101.com/r/CyaPYl/1 Jun 14, 2019 at 4:40
.+
will match anything (that is at least 1 character long), so it effectively cancels your negative lookbehind. Check this solution out:stackoverflow.com/questions/406230/…