使用正则表达式删除隐藏的span标记 [英] Removing hidden span tags using regex

查看:415
本文介绍了使用正则表达式删除隐藏的span标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何编写一个能够找到所有< span>的正则表达式在html文档中的标签,其中style =" visibility:hidden"?

我在另一篇文章中找到了这个表达式并对其进行了修改但它不起作用:

  (?si)< span [^>] *?hidden [^>] *?> \ d {1,3}< / span>   

提前致谢。

解决方案

如果你想在VS IDE中删除这些span标签,那么:



\< span。@ style =(\")* visibility \ :(:b)* hidden(\")*。@ \>。@ \< / span \>



和just当然,用空格替换它。

或者.NET正则表达式:

< span。*?style = \" visibility\:(\ s) ?hidden\"。*?>。*?< / span>



HTH



Temple3188

Does anyone know how to write a regular expression that would find all <span> tags inside a html document where style="visibility: hidden"?

I found this expression in another post and modified it but it doesn't work:

(?si)<span[^>]*?hidden[^>]*?>\d{1,3}</span>

Thanks in advance.

解决方案

If your looking to remove these span tags within the VS IDE then:

\<span.@style=(\")*visibility\:(:b)*hidden(\")*.@\>.@\</span\>

and just replace it with a blank space of course.

Or for the .NET Regular Expression:

<span.*?style=\"visibility\:(\s)?hidden\".*?>.*?</span>

HTH

Temple3188


这篇关于使用正则表达式删除隐藏的span标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆