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

作者:佚名 来源:12it.net 时间:2008-10-29 09:40:00 




           

'把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]+)&ldquo;
        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=http://www.chinaz.com/Program/Asp/""1.gif"">"
pic = toppic(code1,"html","nopic.gif")
response.Write pic

标签:
0
投稿

猜你喜欢

  • php获取访问者IP地址汇总

    2023-11-14 12:14:06
  • Golang解析JSON遇到的坑及解决方法

    2024-05-10 13:58:29
  • Web设计中的黄金分割[译]

    2009-02-20 13:41:00
  • python select.select模块通信全过程解析

    2022-05-23 13:13:10
  • MySQL数据库数据删除操作详解

    2024-01-13 11:55:42
  • Golang Gin局部和全局中间件使用详解

    2023-07-10 03:03:00
  • Python时间获取及转换知识汇总

    2023-08-02 12:17:08
  • OpenCV+Imutils实现图像的旋转操作

    2021-07-25 20:39:42
  • 怎样修改 MySQL数据库中的密码

    2008-11-27 15:35:00
  • JavaScript实现简单计算器小程序

    2024-05-02 16:28:39
  • python中的list字符串元素排序

    2022-03-14 12:27:14
  • Python argparse中的action=store_true用法小结

    2023-07-31 22:35:02
  • Centos7系统下Mysql主从同步配置方案

    2024-01-24 11:29:18
  • Python实现的逻辑回归算法示例【附测试csv文件下载】

    2023-12-09 21:08:33
  • 关于vue父组件调用子组件的方法

    2024-04-09 10:47:43
  • Linux下为不同版本python安装第三方库

    2023-11-12 05:04:35
  • 盘点Python加密解密模块hashlib的7种加密算法(推荐)

    2021-09-19 01:02:01
  • Django mysqlclient安装和使用详解

    2024-01-13 21:13:08
  • go语言数据结构之前缀树Trie

    2023-08-05 18:15:50
  • 使用mysqldump导入数据和mysqldump增量备份(mysqldump使用方法)

    2024-01-23 15:44:43
  • asp之家 网络编程 m.aspxhome.com