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

ASP
统计在线人数 dxy
ASP 写的自动生成SELECT 表单的函数
自己做采集程序
巧用缓存提高asp程序的性能
多字段模糊搜索的函数
打包上传asp网站
FreeTextBox 中文版下载[含源代码] of asp.net
asp 防止SQL注入代码
asp实现无限级分类的方法js版
多附件上传组件演示
替换数据库内容
E-mail表单递交
也谈采集入库的技术
先锋海盗类
XML相关技术资料
让ASP搭配MYSQL
ASP远程保存图片
整理了下手动注入脚本命令[带注释]
也谈跨站脚本攻击与防御
突破空格的限制

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 102 ::
收藏到网摘: 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