asp中去除html中style,javascript,css代码

剔除页面中html中除文字以外的任何代码,刚才发布了php版这个是ASP中的版本。

asp函数代码
复制代码 代码如下:

<%
Function RemoveHTML(str)
Dim objRegExp, Match,strHTML
if isnull(str) then
str=""
end if
strHTML=str
strHTML=replace(replace(replace(strHTML,vblf,""),vbcr,""),vbcrlf,"")


Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True

objRegExp.Pattern = ""
strHTML = objRegExp.Replace(strHTML,"")

objRegExp.Pattern = "]*?>.*?"
strHTML = objRegExp.Replace(strHTML,"")

objRegExp.Pattern = "<.+?>"
strHTML = objRegExp.Replace(strHTML,"")

Set objRegExp = Nothing

RemoveHTML=strHTML
End Function
%>

php中的代码
复制代码 代码如下: