当前位置: 首页 > 图文教程 > 网络编程 > ASP > 自动去除字符中含有html代码的几个ASP函数

ASP
构建你的网站新闻自动发布系统之三
构建你的网站新闻自动发布系统之四
如何用ASP编写网站统计系统一
如何用ASP编写网站统计系统二
如何用ASP编写网站统计系统三
如何用ASP编写网站统计系统四
ASP Error 0115的一些解决办法
ASP 3.0 新特色先睹为快(一)
ASP 3.0 新特色先睹为快(二)
ASP主件中的安全问题
一个汉字转成拼音的代码
使用w3Sockets组件实现域名查询功能
ASP中实现文件上传方法的研究
构建免受FSO组件威胁虚拟主机
用XMLHTTP做一个自己特色的Google
用asp实现的代码批量修改程序
无组件的数据库的备份与还原
用ASPJPEG组件制作图片的缩略图和加水印
解密ASP源代码
XmlHttp异步获取网站数据的例子

自动去除字符中含有html代码的几个ASP函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 95 ::
收藏到网摘: n/a

以下为引用的内容:
Function stripHTML(strHTML)
'Strips the HTML tags from strHTML
Dim objRegExp, strOutput
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<.+?>"
'Replace all HTML tag matches with the empty string
strOutput = objRegExp.Replace(strHTML, "")
'Replace all < and > with < and >
strOutput = Replace(strOutput, "<", "<")
strOutput = Replace(strOutput, ">", ">")
stripHTML = strOutput 'Return the value of strOutput
Set objRegExp = Nothing
End Function

以下为引用的内容:
Public Function Replacehtml(Textstr)
Dim Str,re
Str=Textstr
Set re=new RegExp
re.IgnoreCase =True
re.Global=True
re.Pattern="<(.[^>]*)>"
Str=re.Replace(Str, "")
Set Re=Nothing
Replacehtml=Str
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

以下为引用的内容:
Function stripHTML(strHTML)
'Strips the HTML tags from strHTML
Dim objRegExp, strOutput
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<.+?>"
'Replace all HTML tag matches with the empty string
strOutput = objRegExp.Replace(strHTML, "")
'Replace all < and > with < and >
strOutput = Replace(strOutput, "<", "<")
strOutput = Replace(strOutput, ">", ">")
stripHTML = strOutput 'Return the value of strOutput
Set objRegExp = Nothing
End Function