[英]Regex Find/Replace in Notepad++ including new lines
Need to replace/remove multiple occurrences in notepad++ using regex.需要使用正则表达式替换/删除记事本++中的多次出现。 Here is an example:
下面是一个例子:
....
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>
...
I need to replace/remove everything in between "<item>"
and "</item>"
, matches could include a new line.我需要替换/删除
"<item>"
和"</item>"
,匹配项可能包含一个新行。
So I would end up with something like this:所以我最终会得到这样的结果:
....
something<item></item>
text<item></item>
<item></item>
...
One way to do this find/replace :执行此查找/替换的一种方法:
Find what: (<item>).*?(<\\/item>)\\R?
找到什么:
(<item>).*?(<\\/item>)\\R?
Replace with: $1$2
替换为:
$1$2
Check the Matches new line
checkbox.选中
Matches new line
复选框。
More information:Notepad++ User Manual - Regular Expressions更多信息:Notepad++ 用户手册 - 正则表达式
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.