http://blog.360dseo.com/html/826.html
作者: 不详
发布时间:2014-4-23 16:46:19
这个VBS是用来将一个本地网页中的URL筛选出来并保存在新的网页文件中。当然,只要改变里面的正则表达式,就可以作其他用途了。
使用方法:将下面的代码保存为360dseo.vbs
然后拖动你保存在本地的htm页面,拖放在这个vbs即可
复制代码 代码如下:
'备注:URL筛选小工具
'防止出现错误
On Error Resume Next
'vbs代码开始----------------------------------------------
Dim p,s,re
If Wscript.Arguments.Count=0 Then
Msgbox "请把网页拖到本程序的图标上!",,"提示"
Wscript.Quit
End If
For i= 0 to Wscript.Arguments.Count - 1
p=Wscript.Arguments(i)
With CreateObject("Adodb.Stream")
.Type=2
.Charset="GB2312"
.Open
.LoadFromFile=p
s=.ReadText
Set re =New RegExp
re.Pattern= "[A-z]+://[^""<>()\s']+"
re.Global = True
If Not re.Test(s) Then
Msgbox "该网页文件中未出现网址!",,"提示"
Wscript.Quit
End If
Set Matches = re.Execute(s)
s=""
For Each Match In Matches
s=s & "" & Match.Value & "
.SaveToFile p & "'s URLs.html",2
'vbs代码结束----------------------------------------------