我正在 VSCode 中处理 kml (xml) 文件。
使用一个命令/宏删除这两个(再加上 265 个)<description><![CDATA[<center><table><tr><th colspan='2' align='center'>
<em>Attributes</em></th></tr><tr bgcolor="#E3E3F3">
<th>NAME</th>
<td>Anderson</td>
</tr><tr bgcolor="#E3E3F3">
</tr></table></center>]]>
</description>
<description><![CDATA[<center><table><tr><th colspan='2' align='center'>
<em>Attributes</em></th></tr><tr bgcolor="#E3E3F3">
<th>NAME</th>
<td>Billingsly</td>
</tr><tr bgcolor="#F00000">
</tr></table></center>]]>
</description>
谢谢你,保罗
最佳答案
您可以在 vscode 查找/替换中使用此正则表达式:
\n?<description>[\S\s\n]*?<\/description>\n?
并替换为空。
\n?
如果您还想删除标记所在的行,则在开头和结尾处都在那里 - 看看它是如何工作的,如果您不关心删除内容以前所在的空行,则可以删除这些行。显然,如果您输入格式错误,例如不匹配的
<description>
或 </description>
标记正则表达式将不起作用。
关于visual-studio-code - VSCode : Delete all occurences of xml tag pair including differing contents,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54536155/