正则表达式在 Notepad ++ 中查找/替换包括新行

0 regex notepad++

需要使用正则表达式替换/删除记事本++中的多次出现。下面是一个例子:

....
something<item>text to be removed or replaced</item>
text<item>another text to be
removed or replaced</item>
<item>more text to be removed or 
replaced</item>
...
Run Code Online (Sandbox Code Playgroud)

我需要替换/删除"<item>"和之间的所有内容"</item>",匹配可能包括一个新行。

所以我最终会得到这样的结果:

....
something<item></item>
text<item></item>
<item></item>
...
Run Code Online (Sandbox Code Playgroud)

Gom*_*ero 5

执行此查找/替换的一种方法:

找什么: (<item>).*?(<\/item>)\R?

用。。。来代替: $1$2

选中Matches new line复选框。

在此处输入图片说明

更多信息:Notepad++ 用户手册 - 正则表达式