简体   繁体   中英

notepad++ Inverse Regex replace (all but string)

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++

^((?!hello).)*$在Notepad ++ 6中工作。我想知道它是否比这更好: ^(?!.*hello).*$

the new Version (I Recently updated to 6.2.2) has the ! operator implemented. I just tried it and it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM