<%
str="<img src=images/200610261533.jpg><img src=""images/200609151656.jpg""><img src=images/200609051735.JPG>"
response.write(GetImgSrc(str))
function GetImgSrc(str) '取得img 標簽內容
dim tmp
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True '忽略大小寫
objRegExp.Global = false '全文搜索 !關鍵!
objRegExp.Pattern = "<img (.*?)src=(.[^\[^>]*)(.*?)>"
Set Matches =objRegExp.Execute(str)
For Each Match in Matches
tmp=tmp & Match.Value
Next
GetImgSrc=getimgs(tmp)
end function
function getimgs(str)'取得
Set objRegExp1 = New Regexp
objRegExp1.IgnoreCase = True '忽略大小寫
objRegExp1.Global = True '全文搜索
objRegExp1.Pattern = "src\=.+?\.(gif|jpg|png|bmp)"
set mm=objRegExp1.Execute(str)
For Each Match1 in mm
imgsrc=Match1.Value
'也許存在不能過濾的字符,確保萬一
imgsrc=replace(imgsrc,"""","")
imgsrc=replace(imgsrc,"src=","")
imgsrc=replace(imgsrc,"<","")
imgsrc=replace(imgsrc,">","")
imgsrc=replace(imgsrc,"img","")
imgsrc=replace(imgsrc," ","")
getimgs=getimgs&imgsrc'把裡面的地址串起來備用
next
end function
%>