记事本++反向正则表达式替换(除字符串外的所有内容) [英] notepad++ Inverse Regex replace (all but string)

查看:52
本文介绍了记事本++反向正则表达式替换(除字符串外的所有内容)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我基本上希望匹配包含这个字符串Hello"的每一行

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

示例:

sdfsdoifdoskf
fdgokfdghodfkg
hello
fdojgohdfgjkdfg
gfobjobhkdfokgdfg
dofjkdsf hello dfgkdfogdfg
xcvmxhckvmxck
fogkdfhokg
hello

我尝试了这个正则表达式模式:^((?!hello).)*$

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

未找到匹配项.

基本上我想使用记事本++删除包含字符串hello"的每一行

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

推荐答案

^((?!hello).)*$ 适用于 Notepad++ 6.不知道有没有比这个更好的:^(?!.*hello).*$

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

这篇关于记事本++反向正则表达式替换(除字符串外的所有内容)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆