虚位以待(AD)
虚位以待(AD)
首页 > 网络编程 > ASP编程 > ASP编程怎样获得代码中第一张图片地址

ASP编程怎样获得代码中第一张图片地址
类别:ASP编程   作者:码皇   来源:互联网   点击:

把pattern 又修改了下   code要检测的代码   http: www knowsky com ASP编程 ASP编程   leixing html 或者ubb   nopic 代码没有图片时默认值function toppic(code,leixing,nopic)    set reg ,魔客吧

把pattern 又修改了下

  'code要检测的代码

  'http://www.knowsky.com/ASP编程.ASP编程

  'leixing html 或者ubb

  'nopic 代码没有图片时默认值

function toppic(code,leixing,nopic)
    set regex = new regexp
    regex.ignorecase = true
    regex.global = true
    if leixing = "html" then
        regex.pattern = "]+)"
    else
        regex.pattern = "[img]([^u005B]+)“
    end if
    set matches = regex.execute(code)
    if regex.test(code) then
                 if leixing = "html" then
              toppic = matches(0).submatches(3)
                 else
                      toppic = matches(0).submatches(0)
                 end if
    else
        toppic = nopic
    end if
end function
code1 = ""
pic = toppic(code1,"html","nopic.gif")
response.Write pic

相关热词搜索: ASP编程怎样获得代码中第一张图片地址