16

I essentially wish to match every line that DOES NOT contain this string "Hello"

Example:

sdfsdoifdoskf
fdgokfdghodfkg
hello
fdojgohdfgjkdfg
gfobjobhkdfokgdfg
dofjkdsf hello dfgkdfogdfg
xcvmxhckvmxck
fogkdfhokg
hello

I attempted this Regex pattern : ^((?!hello).)*$

No matches found.

Basically i want to remove every line that does not contain the string "hello" using notepad++

Ken White
  • 123,280
  • 14
  • 225
  • 444
user1064906
  • 161
  • 1
  • 1
  • 4

2 Answers2

9

^((?!hello).)*$ works in Notepad++ 6. I wonder if it's better than this: ^(?!.*hello).*$

Cees Timmerman
  • 17,623
  • 11
  • 91
  • 124
0

As Karsten suggested in a comment, one can use the LineFilter2 plugin in Notepad++, which is straightforward to install and use.

enter image description here

To install:

enter image description here

To launch:

enter image description here

Franck Dernoncourt
  • 77,520
  • 72
  • 342
  • 501