[VB.NET]求一个正则表达式处理一下html

来源:互联网 发布:网络机顶盒推荐 编辑:程序博客网 时间:2024/03/29 17:30
VB.NET源码-156个实用实例哦……<script type="text/javascript"><!--google_ad_client = "pub-8333940862668978";/* 728x90, 创建于 08-11-30 */google_ad_slot = "4485230109";google_ad_width = 728;google_ad_height = 90;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
求一个正则表达式处理一下html
想去除html中除链接标记之外的所有标记,即字符串中遇到象 <...> 这样的部分,如果其中包含href或/a则保留,其余删除。
我原来是这么写的:
For Each m As Match In Regex.Matches(ss, <[^> ]*> , egexOptions.IgnoreCase)
If InStr(LCase(m.Value), href ) < 1 AndAlso LCase(m.Value) <> then
ss = Replace(ss, m.Value, )
End If
Next
不过我觉得这么作可能效率比较低,希望能通过一条正则表达式搞定。
__________________________________________________________________________
up
__________________________________________________________________________
顶顶...
__________________________________________________________________________
何必呢,那不会取出所有的 标签,而不是去除所有不是 的标签.
__________________________________________________________________________
我就是要去除所有不是
的标签
__________________________________________________________________________
我的意思是,用正则表达式,取出所有是
的内容.
__________________________________________________________________________
try

<(?!(a/s|/a> ))[^> ]*?>
__________________________________________________________________________
原创粉丝点击