最新更新 sitemap 网站制作设计本站搜索
网页设计
国外网站 韩国网站 个人主页 手提袋设计 CSS 网页特效 平面设计 网站设计 Flash CMS技巧 服装网站 php教程 photoshop 画册 服务器选用 数据库 Office
虚拟主机 域名注册 云主机 网页设计 客服QQ:8208442
当前位置:首页 > 编程开发 > asp教程

ASP正则匹配img标签技巧

日期:05-17    来源:中国设计秀    作者:cnwebshow.com

可以模仿QQ空间里有图片的话就在标题后显示有附件的图片sgQ中国设计秀

asp/Visual Basic代码:sgQ中国设计秀

sgQ中国设计秀
 程序代码sgQ中国设计秀

<%sgQ中国设计秀
'***************************************************    sgQ中国设计秀
'*函数名 : GetImgFromContent    sgQ中国设计秀
'*参数说明 : html 被提取的html 代码    sgQ中国设计秀
'*功能简介 : 提取这部分html代码中的图片    sgQ中国设计秀
'*程序作者 : evio http://www.backci.cn/code sgQ中国设计秀
'*http://www.knowsky.com/   sgQ中国设计秀
'***************************************************    sgQ中国设计秀
function GetImgFromContent(html)    sgQ中国设计秀
    Dim Re, match, matchs, htm, t    sgQ中国设计秀
    htm = ""   sgQ中国设计秀
    set Re = new RegExp    sgQ中国设计秀
    re.IgnoreCase =True     sgQ中国设计秀
    re.Global = True     sgQ中国设计秀
    re.Pattern = "<img [^<]*src=""(.*)""[^>]*>" '--<img [^<]*src=""(.*)""[^>]*>    sgQ中国设计秀
    Set matchs = re.Execute(html)    sgQ中国设计秀
    for each match in matchs    sgQ中国设计秀
        htm = htm + (match.SubMatches(0)) & "|$|"   sgQ中国设计秀
    next    sgQ中国设计秀
    set matchs = nothing    sgQ中国设计秀
    t = split(htm, "|$|")(0)    sgQ中国设计秀
    if len(t) = 0 or t = "" then    sgQ中国设计秀
        t = "_template_Images/PRive.jpg"   sgQ中国设计秀
    end if    sgQ中国设计秀
    ze = "<img src='" & t & "' width='191' height='119' />"   sgQ中国设计秀
end functionsgQ中国设计秀
%>sgQ中国设计秀

本文引用地址:/bc/article_46280.html
网站地图 | 关于我们 | 联系我们 | 网站建设 | 广告服务 | 版权声明 | 免责声明