VBS取出(提取)一段文本里的所有图片地址[正则表达式实现]
作者:JiaJia 日期:2007-08-05
<script language = vbs>
Str = "<img src=""123.Gif"" alt=""dsddfsa"" > <img src=""123.jpG"" > <img src=""123.jpg""><IMG SRC=123.JPG>"
'使用方法:把这个文件存为getImages.vbs,然后运行便可看到效果
Function getImages(Str)
Set re = New RegExp
re.Pattern = "<img(.+?)src=""*([^\s]+?)""*(\s|>)"
re.Global = True
re.IgnoreCase = True
Set Contents = re.Execute(Str)
For Each Match in Contents ' 遍历匹配集合。
Images = Images + Match.SubMatches(1) + "|"
Next
getImages = Mid(Images, 1, Len(Images) -1)
End Function
MsgBox(getImages(Str))
</script>
Str = "<img src=""123.Gif"" alt=""dsddfsa"" > <img src=""123.jpG"" > <img src=""123.jpg""><IMG SRC=123.JPG>"
'使用方法:把这个文件存为getImages.vbs,然后运行便可看到效果
Function getImages(Str)
Set re = New RegExp
re.Pattern = "<img(.+?)src=""*([^\s]+?)""*(\s|>)"
re.Global = True
re.IgnoreCase = True
Set Contents = re.Execute(Str)
For Each Match in Contents ' 遍历匹配集合。
Images = Images + Match.SubMatches(1) + "|"
Next
getImages = Mid(Images, 1, Len(Images) -1)
End Function
MsgBox(getImages(Str))
</script>
评论: 0 | 引用: 0 | 查看次数: -
发表评论
上一篇
下一篇

文章来自:
Tags: