ASP中过滤UBB和Html标签

来源:互联网 发布:淘宝客网站被微信屏蔽 编辑:程序博客网 时间:2024/04/29 17:04
我们存储在数据库中的内容是HTML格式的,但是有时候我们需要无格式的显示这内容,这是用正则表达式实现的过滤。
<%
function nohtml(str)
dim re
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
re.Pattern="(/<.[^/<]*/>)"
str=re.replace(str," ")
re.Pattern="(/<//[^/<]*/>)"
str=re.replace(str," ")
nohtml=str
set re=nothing
end function
%>
原创粉丝点击