中华网络安全联盟 收藏本站
设为主页
商务合作
首页 新闻中心 行业动态 软件新闻 安全资讯 病毒预警 漏洞发布 操作系统 Dos Win9x Win2000 WinXP Win2003 WinVista Linux Unix
数据库 DB2 Access MSSQL MySQL Oracle Sybase 编程技术 ASP PHP JSP CGI/Perl XML .Net C/C++/C# VB VC Delphi Java 汇编
安全技术 安全教学 工具介绍 漏洞利用 病毒防范 入侵检测 防火墙 安全防范 汉化破解 攻击实例 加密解密 进程知识 技术论坛
中华网络安全联盟 >> 程序开发 >> ASP >> ASP怎样可以获得代码中第一张图片地址
程序开发
Asp
PHP
JSP
CGI/Perl
XML
.Net
C/C++/C#
Visual Basic
Visual C++
Delphi
Java
汇编语言
ASP安全:简单学习ASP
ASP开发的WAP格式简易
简单一招用ASP实现对I
asp基础教程:网页间数
ASP优化:几招提高ASP
asp控制xml数据库的6段
ASP进阶:用ASP制作统
ASP进阶:验证身份证号
ASP怎样可以获得代码中第一张图片地址
字体:

中华网络安全联盟    作者:奇趣    来源:奇趣技术网    时间:2008-5-28 9:45:43

'把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
字体:
 
设为主页 收藏本站 联系我们 友情连接 商务合作 网友留言
Copyright©2006-2008 中华网络安全联盟 All rights reserved.