Extract URLs from HTML with vb.net

Extract URLs from HTML with vb.net. In this example the HTML is in TextBox1 and it will store the URLs in a listbox named URLsResult.


Dim strReg As String
Dim RunShit As String
strReg = ".*?)[""'].*?>(?.*?)"
Dim reg As New Regex(strReg, RegexOptions.IgnoreCase)
Dim m As Match = reg.Match(TextBox1.Text)

While m.Success
RunShit = m.Groups(1).Value
If RunShit.Substring(0, 4) = "http" Then
URLsResult.Items.Add(RunShit) '
End If
m = m.NextMatch()
End While

Leave a Reply

Your email address will not be published. Required fields are marked *