ASP超级链接和HTML函数 正则表达式的使用,最后一个实例经过测试。
过滤超级链接
Function RegRemoveHref(HTMLstr)
Set ra = New RegExp
ra.IgnoreCase = True
ra.Global = True
ra.Pattern = "]+>(.+?)<\/A>"
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|\r\n| |\t| )"
Set Matches = objRegExp.Execute(strHTML)
For Each Match in Matches
strHtml=Replace(strHTML,Match.Value,"")
Next
objRegExp.Pattern = "(\r|\n|\r\n| |\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 代码 这个代码的作用是去掉用"
reg.IgnoreCase = True
reg.Global = True
clearJSCode = reg.Replace(originCode, "")
End Function
复制代码 代码如下:
Function RegRemoveHref(HTMLstr)
Set ra = New RegExp
ra.IgnoreCase = True
ra.Global = True
ra.Pattern = "]+>(.+?)<\/A>"
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|\r\n| |\t| )"
Set Matches = objRegExp.Execute(strHTML)
For Each Match in Matches
strHtml=Replace(strHTML,Match.Value,"")
Next
objRegExp.Pattern = "(\r|\n|\r\n| |\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 代码 这个代码的作用是去掉用"
reg.IgnoreCase = True
reg.Global = True
clearJSCode = reg.Replace(originCode, "")
End Function
二、清除内容中的HTML代码
复制代码 代码如下:
Function ClearHTMLCode(originCode)
Dim reg
set reg = new RegExp
reg.Pattern = "<[^>]*>"
reg.IgnoreCase = True
reg.Global = True
ClearHTMLCode = reg.Replace(originCode, "")
End Function
复制代码 代码如下:
parser9527=function()
{
var ss=sourcehtml;
ss=ss.replace(/<.*?>/ig,"");
ss=ss.replace(/(\r|\n|\r\n| |\t| )/ig,"");
ss=ss.replace(/(<\/a>)/ig,"");
ss=ss.replace(//ig,"");
ss=ss.replace("_网易新闻中心","");
/*
ss=ss.replace(/