Imports System.Text.RegularExpressions
Public Class frmMain
Inherits System.Windows.Forms.Form
Dim oWebClient As New System.Net.WebClient
Dim bSourceCode() As Byte
Function GetSourceCode(ByVal sUrl As String) As String
'取得网页的网址并取得文本代码
bSourceCode = oWebClient.DownloadData(sUrl)
GetSourceCode = System.Text.Encoding.Default.GetString(bSourceCode)
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strTemp As String
strTemp = GetSourceCode("网页地址")
Dim objRegExp As Regex
Dim objMatch As Match
Dim objMatchs As MatchCollection
objMatchs = objRegExp.Matches(strTemp, "http:([/w.]+//?)/S*")
For Each objMatch In objMatchs
Debug.WriteLine(objMatch.Value)
Next
End Sub
End Class