35

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?

Ringger81
  • 1,157
  • 3
  • 11
  • 25
  • 1
    The .+ will match anything (that is at least 1 character long), so it effectively cancels your negative lookbehind. Check this solution out:https://stackoverflow.com/questions/406230/regular-expression-to-match-a-line-that-doesnt-contain-a-word – whatever Dec 21 '17 at 12:48

2 Answers2

48

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

vera
  • 1,270
-3

Another try for this case: (SCREEN){0}.*$

Hope that can help.

TraXanh
  • 19