asp/vbscript 函数RemoveHTML(),正则表达式高效删除所有html标签,包括javascript及CSS标签<script…>xxx</script>与<style…>xxx</style>
”删除字符串中所有html标记,包括javascript及css代码区块,同时删除换行符
” by fengyqf 20100929
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 = “<script[^>]*?>.*?</script>”
strHTML = objRegExp.Replace(strHTML,””)
objRegExp.Pattern = “<style[^>]*?>.*?</style>”
strHTML = objRegExp.Replace(strHTML,””)
objRegExp.Pattern = “<.+?>”
strHTML = objRegExp.Replace(strHTML,””)
Set objRegExp = Nothing
RemoveHTML=strHTML
End Function