问题
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++
回答1:
^((?!hello).)*$ works in Notepad++ 6. I wonder if it's better than this: ^(?!.*hello).*$
回答2:
the new Version (I Recently updated to 6.2.2) has the ! operator implemented. I just tried it and it works.
来源:https://stackoverflow.com/questions/8264391/notepad-inverse-regex-replace-all-but-string