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

ASP
用EasyMailObject组件处理Exchange邮件源代码(6)
用EasyMailObject组件处理Exchange邮件源代码(7)
利用ASP和Access数据库制作局域网网上答题系统
用ASP开发试题库与在线考试系统(1)
用ASP开发试题库与在线考试系统(2)
用ASP开发试题库与在线考试系统(3)
用ASP开发试题库与在线考试系统(4)
用ASP开发试题库与在线考试系统(5)
用ASP开发试题库与在线考试系统(6)
用ASP开发试题库与在线考试系统(7)
用ASP开发试题库与在线考试系统(8)
综合的判断用户输入的合法性的函数
三层动态下拉菜单的例子
将你的网站设置为客户的信任站点--VB方案
论坛中有新贴子功能的实现
ASP 编程中 15 个非常有用的例子
一个的无组件上传的ASP代码
利用ASP实现三个强大功能之一
利用ASP实现三个强大功能之二
利用ASP实现三个强大功能之三

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


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