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

ASP
ASP XML操作类代码
asp读取xml实例代码
ASP读取XML实例 优酷专辑采集程序 雷锋版
asp自带的内存缓存 application
Cookies 欺骗漏洞的防范方法(vbs+js 实现)
asp清理缓存的代码
asp Driver和Provider两种连接字符串连接Access时的区别
asp 性能测试报告 学习asp朋友需要了解的东西
ASP实例代码:asp操作Excel类
ASP 高亮显示不区分大小写的关键字
ASP XMLDom在服务器端操作XML文件的主要方法和实现
IE8内部对渲染模型的判断流程
web开发人员必须知道的Unicode与字符集相关知识

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 53 ::
收藏到网摘: 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