文章出自:合力绿帆 发布时间:2010-12-4
VBScript code
'==================================================
'*函数名 : GetHrefFromContent
'*参数说明 : html 被提取的html中A代码
'*功能简介 : 提取这部分html代码中A标签的连接地址和名称
'==================================================
function GetHrefFromContent(html)
Dim Re, match, matchs,strContent,aryNum,aryContent,strUrl
strContent = ""
set Re = new RegExp
re.IgnoreCase =True
re.Global = True
re.Pattern = "<a.*?href=(?:""(.*?)""|(.*?))(?:(?: .*?>)|>)(.*?)</a>"
Set matchs = re.Execute(html)
for each match in matchs
'match.SubMatches(0) 基本 0 可改成数组里的其它成员
strContent = strContent + (match.SubMatches(0)) & "|$|"
next
set matchs = nothing
aryContent = split(strContent,"|$|")
for aryNum = LBound(aryContent) to UBound(aryContent)
strUrl = aryContent(aryNum) '连接地址
next
end function
上一篇: 做网站常用代码集锦
下一篇: 禁止查看网页源文件代码 网页防复制代码