且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

删除 XML 中的指定标签 (notepad++)

更新时间:2023-12-05 21:02:34

你总是可以进行查找和替换:

You could always do a find and replace:

find 并替换为空白(确保选中正则表达式)

find <time>[0-9A-Z:-]*</time> and replace with blank (make sure Regular Expressions is checked)

快速说明,这将替换文本文件中以 <time> 开头的所有内容,并包含任意数量的字母数字字符、冒号 (:) 或破折号,后跟 </时间>标签.如果您想删除标签前的空格,您可以使用以下代码:

Quick clarification, this replaces everything in the text file that start with <time> and has any amount of alphanumeric characters, colons (:) or dashes followed by a </time> tag. If you want to remove the spaces before the tag you can use the following instead:

find [\t ]* 替换为空白.

find [\t ]*<time>[0-9A-Z:-]*</time> replace with blank.

如果您想通过这样做删除剩余的空行,您可以使用大多数 Notepad++ 版本中包含的 TextFX 插件:

If you want to remove the empty lines left over by doing this, you can use the TextFX plugin included with most versions of Notepad++:

TextFX -> TextFx 编辑 -> 删除空行

TextFX -> TextFx Edit -> Delete Blank Lines

或者只是切换到扩展查找和搜索 \n\r

Or just switch to extended find and search for \n\r