当前位置:首页 > ASP教程 > 应用技巧

ASP中过滤UBB和Html标签

我们存储在数据库中的内容是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 
%>


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!