PHP .NET 西安网站建设 西安做网站 西安网站制作 西安微信开发

西安网站建设

咨询热线:029-81614085
News/建站资讯
Hotline/咨询热线

电话:029-8161 4085
手机:189 9121 9418

网页设计/ Web design
您的位置:首页 > 建站资讯 > 网页设计

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

浏览次数:860 时间:2011-06-09 08:14:17
以下为引用的内容:

’把pattern 又修改了下
’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(.*?)src\s?\=\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

copyright©2010-2014 西安久博网络科技有限公司 All Right Reserved 陕ICP备11012006号-1
★久博网络★西安网络公司 | 西安网站建设 | 高端品牌网站建设 | 西安手机网站建设 | 西安APP开发
西安久博网络网站建设

用微信扫一扫