Regex Find/Replace in Notepad++ including new lines

為{幸葍}努か 提交于 2020-11-29 21:31:56

问题


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.

So I would end up with something like this:

....
something<item></item>
text<item></item>
<item></item>
...

回答1:


One way to do this find/replace:

Find what: (<item>).*?(<\/item>)\R?

Replace with: $1$2

Check the Matches new line checkbox.

More information: Notepad++ User Manual - Regular Expressions



来源:https://stackoverflow.com/questions/35261772/regex-find-replace-in-notepad-including-new-lines

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!