我正在尝试清理一个由Frontpage生成的html文件,其中有很多需要删除的标签属性,例如:
style="font-size: 10.0pt; font-family: Trebuchet MS; color: blue"
style="color: blue; text-decoration: underline; text-underline: single"
style="color: blue; text-decoration: underline; text-underline: single"
style="font-family: Trebuchet MS"
style="font-size:10.0pt;"
style="color: navy"
我可以通过一个简单的.命令删除一定数量的通配符:
:%s/ style="........"//g
但是有没有办法使这个替换命令中的“.”变得可变长度,这样一个命令就可以删除整个文档中的每个样式属性呢?
PS - 我已经搜索了一些前端清理工具,但不确定它们的可靠性,所以打算自己编写脚本。如果您有什么建议,请告诉我。
.*
是贪婪的,这意味着如果该行上有多个"
,它将获取到最后一个"
的所有内容。 - Sam Brinck