• 教你asp获取A标签下的地址和标题

    2010-12-04

    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 = ")|>)(.*?)"

    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