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

延伸阅读
- asp vbscript报错“字符串空间不够”
- windows下配置apache支持运行asp
- “常见错误 不能打开注册表关键字” 与 “Provider 错误 ’80004005′ 未指定的错误”解决手记
- vbscript/asp函数:extract_by_str,指定起止字符串在字符串中截取子串
- php与asp/vbscript对input表单数组的处理比较
- 使用host文件完美解决ASP错误msxml3.dll 错误 '800c0005'
- 常见错误 不能打开注册表关键字 'Temporary (volatile) Jet DSN 解决方法/asp+access
- windows 2003 iis6 修改上传文件大小
- asp/vbscript版Base64函数/Base64编码Base64encode解码Base64decode
- Linux下的Html编辑器/可视化web网页编辑器
- HTML5 Shiv – 让该死的IE系列支持HTML5
- Html5新标签解释及用法
- Google推荐的15条军规:HTML5代码规范
- Html 5 新特性_布局新标签
- MIME简介与MIME类型大全
0 条评论。