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

ASP
通过ASP与ACCESS数据库建立连接(附源码)(1)
通过ASP与ACCESS数据库建立连接(附源码)(2)
通过ASP与ACCESS数据库建立连接(附源码)(3)
关于页面局部刷新例程
仿照CHINAASP论坛中TOP10写的部分显示代码
用ASP做一个记事本编缉器(附源码)
让您的主页支持各种浏览设备(ASP+篇)(下)
用ASP开发一个在线考试程序(五)
用ASP开发一个在线考试程序(六)
用ASP开发一个在线考试程序(七)
用ASP开发一个在线考试程序(八)
用ASP开发一个在线考试程序(九)
用SQL Server为Web浏览器提供图像1
用SQL Server为Web浏览器提供图像2
用SQL Server为Web浏览器提供图像3(end)
制作一个个人搜索引擎(源码)
制作一个简单的服务器端控制
用Access制作一个功能完善的论坛(源程序)
广告播放和跟踪系统的制作
动态广告管理程序制作例子

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


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