VB用正则表达式提取网页中的链接??
从网页源码中提取超链接地址,怎么写?
<table> <td>
<a href= "http://www.baidu.com/read.php?tid=67636 " id= " "> 源码 </a>
</td>
<tr>
<td>
<a href= "http://www.baidu.com/read.php?tid=5 " id= " "> 源码 </a>
</td>
比如上面的源码
提取
http://www.baidu.com/read.php?tid=67636
http://www.baidu.com/read.php?tid=5
这两个链接
[解决办法]
汗
[解决办法]
可能没人能回答你的帖了,因为今天下午CSDN好像禁止发带URL的帖了。
[解决办法]
gz
[解决办法]
可以再写得详细点吗?最好能给个实例.谢谢~~
[解决办法]
老马,什么是正则?
[解决办法]
mark
[解决办法]
Sub GetURL(ByVal s As String) Dim re As RegExp Dim mh As Match Dim mhs As MatchCollection Set re = New RegExp re.Global = True re.Pattern = "href= ""(http(s)?://[\s\S]+?)""" If re.Test(s) = False Then Exit Sub Set mhs = re.Execute(s) For Each mh In mhs Debug.Print mh.SubMatches(0) NextEnd Sub