0
我使用正則表達式來得到一個網站上的一些信息,我有這樣的代碼:Visual Basic中的正則表達式,但沒有雙引號
Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://www.startkabel.nl/zoeken/index.php?zoek=" & TextBox1.Text)
Dim response As System.Net.HttpWebResponse = request.GetResponse
Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
Dim startpagina As String = sr.ReadToEnd
Dim sp As New System.Text.RegularExpressions.Regex("<a href=http://games.startkabel.nl>games.startkabel.nl</a></td>")
Dim matches As MatchCollection = sp.Matches(startpagina)
For Each itemcode As Match In matches
ListBox1.Items.Add(itemcode.Value.Split("""").GetValue(0))
Next
但<a href=http://games.startkabel.nl>games.startkabel.nl</a></td>
沒有""
因此列表框顯示整個代碼,而我只需要這部分
games.startkabel.nl
我已經嘗試過的代碼改成這樣:
"<a href=""http://games.startkabel.nl"">""games.startkabel.nl""</a></td>"
但它不顯示任何結果。
有人可以幫我解決這個問題嗎?
(對不起我的英語不好)
非常感謝您!它的工作:D – Ruben 2011-03-20 13:01:44