日期:2014-05-17 浏览次数:21000 次
dim str,rx str="<a href='http://www.code-design.cn' target='_blank'>去除HTML标签的功能函数ABCDEFGHIJK</a><div>123</div><li>456</li><li>789</li>" Function FunRemoveHTML(refString) dim regEx,temp set regEx=new RegExp regEx.IgnoreCase=true regEx.Global = true regEx.pattern="<[^>]+>|</[^>]+" temp=regEx.replace(refString,"") set regEx=nothing funRemoveHTML=temp temp=null End function response.Write "<br>str = " & server.HTMLEncode(str) response.Write "<br>str2 = " & FunRemoveHTML(str)
------解决方案--------------------
<% str= "<div>123</div><li>456</li><li>789</li>" Set re = New RegExp With re .Global = True .IgnoreCase = True .Pattern = "<([^>]+)>(\d+)<\/\1>" Set col = .Execute(str) For Each m In col Response.Write m.SubMatches(1) & "<br>" Next End With Set re = Nothing %>