繁体   English   中英

Notepad ++ Regex 替换包含某些字符串

[英]Notepad++ Regex replace containing certain string

我在使用 Notepad++ 和 Regexe 时遇到了一些问题。 我如何才能删除包含“deletethisone”一词的每个“事物”?

thing
beforestuff deletethisone
endthing

thing
beforestuff notthisone
endthing

thing
beforestuff deletethisone
endthing

thing
beforestuff notthisone
endthing

顺便说一下,我启用了“.matches newline”。

如果有人可以帮助解决这个问题,那就太好了。

thing(?=(?:(?!thing|endthing).)*?deletethisone).*?endthing

试试这个。看演示。

http://regex101.com/r/vR4fY4/18

((?<=\n)|^)[^\n]+?\n[^\n]+?deletethisone\n[^\n]+?(?=\n|$)

一个简短的正则表达式

查找内容: (.*\\n.*delete.*\\n.*)
替换为: nothing

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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