特色栏目

ASP源码

PHP源码

.NET源码

JSP源码

游戏频道
专题合集
关闭菜单
首页> ASP教程> ASP如何获得代码中第一张图片地址

ASP如何获得代码中第一张图片地址

时间:2009-06-25 17:46:16 作者:互联网

'把pattern 又修改了下
'code要检测的代码
'http://www.downcodes.com/asp.asp
'leixing html 或者ubb
'nopic 代码没有图片时默认值
function toppic(code,leixing,nopic)
        set regex = new regexp
        re***.ignorecase = true
        re***.global = true
        if leixing = "html" then
                re***.pattern = "]+)"
        else
                re***.pattern = "[img]([^u005B]+)“
        end if
        set matches = re***.execute(code)
        if re***.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")
re***nse.Write pic

相关文章 最新文章

相关应用

热门文章

猜你喜欢

返回顶部