微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ASP怎样获得代码中第一张图片地址

'参数:

'code:要检测的代码

'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 = "<img(.*?)srcs?=s?(u0022?)([^u0022/>]+)"

        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 = "<img src=""1.gif"">"

pic = toppic(code1,"html","nopic.gif")

response.Write pic

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐