18

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?

1

2 Answers 2

34

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

1
  • 2
    I think ^(?:(?!SCREEN).)*$ would be more efficient
    – LorneCash
    Feb 7, 2021 at 22:09
-4

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

Hope that can help.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.