我们存储在数据库中的内容是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
%>
<%
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
%>
博客提到数据库中存储的内容为HTML格式,有时需无格式显示这些内容,为此给出了用正则表达式实现过滤的代码示例,通过定义函数和设置正则规则来替换HTML标签。
607

被折叠的 条评论
为什么被折叠?



