美文网首页
VS Code 正则匹配(冗余代码批量清理方法)

VS Code 正则匹配(冗余代码批量清理方法)

作者: __拾光__ | 来源:发表于2018-04-18 17:43 被阅读0次

清除tppabs标签:

html文件中:

查找:\btppabs="h[^"]*"

替换:(空)

css文件中的图片链接(以gif图片为例):

查找:tpa=http://[^\s]*.gif

替换:(空)

css文件中的注释:

查找:/*tpa.*?*/

替换:(空)

修复confirm链接:

查找:href=" javascript:if(confirm('(htt[^"\s]).*?"

替换:href="$1"

冗余代码示例:href="javascript:if(confirm('http://www.xxxxx.com/ \n\n该文件无法用 Teleport Ultra 下载, 因为 不可用, 或放弃了下载, 或项目即将停止。 \n\n你想在服务器上打开它?'))window.location='http://www.xxxx.com/'"

示例替换后结果:href=http://www.xxxx.com/

相关文章

网友评论

      本文标题:VS Code 正则匹配(冗余代码批量清理方法)

      本文链接:https://www.haomeiwen.com/subject/hskbkftx.html