提取网页或正文内容中的所有图片实际地址,返回以|分开的图片列表。
<%
Option Explicit
'取得文章正文内容的所有图片地址
Function FormatImg(content)
dim re,mm,Match1,getimgs
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
re.Pattern="<img.[^>]*src(= )(.[^>]*)>"
set mm=re.Execute(content)
For Each Match1 in mm
getimgs=getimgs&imgurl(Match1.Value)&""
'getimgs=imgurl(Match1.Value)
'exit for
next
set re = nothing
FormatImg = server.HTMLEncode(getimgs)
End Function
Function imgurl(str)
dim tmpstr
if instr(str,"src=")>0 then
tmpstr = split(str,"src=")(1)
if instr(tmpstr,"""")>0 then
tmpstr = split(tmpstr,"""")(1)
end if
if instr(tmpstr,"'")>0 then
tmpstr = split(tmpstr,"'")(1)
end if
else
tmpstr = ""
end if
imgurl = tmpstr
End Function
response.write FormatImg("<p>阿里西西Web开发之家</p><script src=""http://www.alixixi.com/ads/ads.asp""></script><img border=""0"" alt="""" width=""556"" height=""1070"" src=""http://www.alixixi.com/adsview/UploadPic/2009-5/i4.gif"" /><div><center><a target=""_blank"" href=""http://www.alixixi.com/adsview/UploadPic/2009-5/i4.gif""><img border=""0"" alt="""" width=""556"" height=""1070"" src=""http://www.alixixi.com/adsview/UploadPic/2009-5/i2.gif"" /></a><br />阿里西西Web开发之家<br /></center></div>")
%>