特色栏目

ASP源码

PHP源码

.NET源码

JSP源码

游戏频道
专题合集
关闭菜单
首页> ASP教程> ASP正则匹配img标签

ASP正则匹配img标签

时间:2009-06-26 18:10:31 作者:互联网

可以模仿QQ空间里有图片的话就在标题后显示有附件的图片

ASP/Visual Basic代码:


 程序代码

<%
'***************************************************   
'*函数名 : GetImgFromContent   
'*参数说明 : html 被提取的html 代码   
'*功能简介 : 提取这部分html代码中的图片   
'*程序作者 : evio
'*http://www.down*co**des.com/  
'***************************************************   
function GetImgFromContent(html)   
    Dim Re, match, matchs, htm, t   
    htm = ""  
    set Re = new RegExp   
    re.IgnoreCase =True    
    re.Global = True    
    re.Pattern = "]*>" '--]*>   
    Set matchs = re.Execute(html)   
    for each match in matchs   
        htm = htm + (match.SubMatches(0)) & "|$|"  
    next   
    set matchs = nothing   
    t = split(htm, "|$|")(0)   
    if len(t) = 0 or t = "" then   
        t = "_template_Images/prive.jpg"  
    end if   
    ze = ""  
end function
%>

相关文章

热门文章

猜你喜欢

返回顶部