当前位置: 编程技术>其它
ASP超级链接和HTML函数正则表达式 修正版
来源: 互联网 发布时间:2014-10-16
本文导语: 过滤超级链接 代码如下:Function RegRemoveHref(HTMLstr) Set ra = New RegExp ra.IgnoreCase = True ra.Global = True ra.Pattern = "]+>(.+?)" RegRemoveHref = ra.replace(HTMLstr,"$1") END Function 过滤所有HTML代码 代码如下:Function RemoveHTML(strHTML) Dim objRegExp, Match, Matches S...
过滤超级链接
Function RegRemoveHref(HTMLstr)
Set ra = New RegExp
ra.IgnoreCase = True
ra.Global = True
ra.Pattern = "]+>(.+?)"
RegRemoveHref = ra.replace(HTMLstr,"$1")
END Function
过滤所有HTML代码
Function RemoveHTML(strHTML)
Dim objRegExp, Match, Matches
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
'取闭合的
objRegExp.Pattern = ""
'进行匹配
Set Matches = objRegExp.Execute(strHTML)
' 遍历匹配集合,并替换掉匹配的项目
For Each Match in Matches
strHtml=Replace(strHTML,Match.Value,"")
Next
RemoveHTML=strHTML
Set objRegExp = Nothing
End Function
过滤所有HTML代码 和空格换行
Function RemoveHTML(strHTML)
Dim objRegExp, Match, Matches
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = ""
'objRegExp.Pattern = "(r|n|rn| |t| )"
Set Matches = objRegExp.Execute(strHTML)
For Each Match in Matches
strHtml=Replace(strHTML,Match.Value,"")
Next
objRegExp.Pattern = "(r|n|rn| |t| )"
Set Matches = objRegExp.Execute(strHTML)
For Each Match in Matches
strHtml=Replace(strHTML,Match.Value,"")
Next
RemoveHTML=strHTML
Set objRegExp = Nothing
End Function
asp使用正则表达式去除script代码和HTML代码
一、清楚内容中的Javsscript 代码 这个代码的作用是去掉用parser9527=function()
{
var ss=sourcehtml;
ss=ss.replace(//ig,"");
ss=ss.replace(/(r|n|rn| |t| )/ig,"");
ss=ss.replace(/()/ig,"");
ss=ss.replace(//ig,"");
ss=ss.replace("_网易新闻中心","");
/*
ss=ss.replace(/
代码如下:
Function RegRemoveHref(HTMLstr)
Set ra = New RegExp
ra.IgnoreCase = True
ra.Global = True
ra.Pattern = "]+>(.+?)"
RegRemoveHref = ra.replace(HTMLstr,"$1")
END Function
过滤所有HTML代码
代码如下:
Function RemoveHTML(strHTML)
Dim objRegExp, Match, Matches
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
'取闭合的
objRegExp.Pattern = ""
'进行匹配
Set Matches = objRegExp.Execute(strHTML)
' 遍历匹配集合,并替换掉匹配的项目
For Each Match in Matches
strHtml=Replace(strHTML,Match.Value,"")
Next
RemoveHTML=strHTML
Set objRegExp = Nothing
End Function
过滤所有HTML代码 和空格换行
代码如下:
Function RemoveHTML(strHTML)
Dim objRegExp, Match, Matches
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = ""
'objRegExp.Pattern = "(r|n|rn| |t| )"
Set Matches = objRegExp.Execute(strHTML)
For Each Match in Matches
strHtml=Replace(strHTML,Match.Value,"")
Next
objRegExp.Pattern = "(r|n|rn| |t| )"
Set Matches = objRegExp.Execute(strHTML)
For Each Match in Matches
strHtml=Replace(strHTML,Match.Value,"")
Next
RemoveHTML=strHTML
Set objRegExp = Nothing
End Function
asp使用正则表达式去除script代码和HTML代码
一、清楚内容中的Javsscript 代码 这个代码的作用是去掉用parser9527=function()
{
var ss=sourcehtml;
ss=ss.replace(//ig,"");
ss=ss.replace(/(r|n|rn| |t| )/ig,"");
ss=ss.replace(/()/ig,"");
ss=ss.replace(//ig,"");
ss=ss.replace("_网易新闻中心","");
/*
ss=ss.replace(/