php专区

 首页 > php专区 > 正则表达式 > ASP超级链接和HTML函数正则表达式 修正版_正则表

ASP超级链接和HTML函数正则表达式 修正版_正则表

分享到:
【字体:
导读:
          ASP超级链接和HTML函数 正则表达式的使用,最后一个实例经过测试。...

过滤超级链接
复制代码 代码如下:

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 代码 这个代码的作用是去掉用"
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

复制代码 代码如下:

var sourcehtml=function(){/*%s*
分享到:
javascript 获取url参数的正则表达式(用...
例子: //javascript传参数(多个) var url = "B.aspx?txtA="+document.getElementById("txtName").value; url +="&txtB="+document.getElementById("txtAge").value; window.open(url,&#039;xWindow&#039;,&#039;width=640,height=400,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,top=250,lef...
php 正则表达式提取网页超级链接url的函...
复制代码 代码如下: function match_links($document) { preg_match_all("&#039;
  •         php迷,一个php技术的分享社区,专属您自己的技术摘抄本、收藏夹。
  • 在这里……