当前位置: 首页 > 图文教程 > 网络编程 > ASP > ASP怎样可以获得代码中第一张图片地址

ASP
ASP应用 用GetString来提高ASP的速度
ASP怎样可以获得代码中第一张图片地址
ASP开发经验谈 ASP开发10条经验总结
如何用ASP来获取客户端真实IP的地址?
用ASP实现就MP3曲目信息的操作全攻略
ASP中连接数据库的错误解决新解决办法
ASP后门之终极伪装
ASP生成静态htm页面基本代码
session在验证管理登陆时的使用方法
asp当中判断函数一览
IIS6.0 ASP 错误解析
ASP与JSP的区别和联系
几种打开记录集方式的比较
cookie和session机制之间的区别与联系
ASP的含义、功能和选择
ASP中巧用Response属性 -- contenttype
ASP内置对象Request和Response的详解
ASP错误大全
人文的ASP开发基础入门之简介
ASP 3.0高级编程(十二)

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 50 ::
收藏到网摘: n/a

'把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 = "<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