28,391
社区成员
发帖
与我相关
我的任务
分享
<%
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
%>
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)