ASP如何清除a标签及所包含的文字内容!

来源:百度知道 编辑:UC知道 时间:2024/06/02 20:05:58
客户在发布信息时总喜欢将自己的网址打上,我想在存取content内容字段时,自动过滤a标签及所包含的文字该怎么做?

<%
Function RemoveHTML(str)
Dim re
Set re=New RegExp
re.Pattern="<[a|A]+[^>]*>" '请参考学习正则表达式
re.IgnoreCase=True
re.Global=True
str=re.Replace(str,"")
Set re=Nothing
RemoveHTML=str
End Function

'测试
str = RemoveHTML(rs("content"))
response.write str
%>