0
您好,我試圖從HTML網頁獲取特定的單詞,並試圖通過加載HTML源代碼到文本框然後過濾出來。如何刪除vb.net不包含特定字詞的Richtextbox行
我現在正在使用這個至關重要的是我知道,但我怎麼能融合在一起,它會檢查兩個單詞在1循環?
Dim Filter1 = "filterword1"
Dim Filter2 = "filterword2"
TextBox1.Text = WebBrowser1.DocumentText
TextBox2.Text = WebBrowser1.DocumentText
Dim lines As New List(Of String)
lines = TextBox1.Lines.ToList
For i As Integer = lines.Count - 1 To 0 Step -1
If Not Regex.IsMatch(lines(i), Filter1) Then
lines.RemoveAt(i)
End If
Next
TextBox1.Lines = lines.ToArray
Dim lines1 As New List(Of String)
lines1 = TextBox3.Lines.ToList
For i As Integer = lines1.Count - 1 To 0 Step -1
If Not Regex.IsMatch(lines1(i), Filter2) Then
lines1.RemoveAt(i)
End If
Next
TextBox1.Lines = lines1.ToArray
嘗試使用foreach循環 – c4pricorn