Hello everyone,
I am trying to capture URLs in HTML file which appears like
I found this code but it does not work well.
Thank You
I am trying to capture URLs in HTML file which appears like
Code:
<a[string]href[space(s) or nothing]=[space(s) or nothing]["][URL]["][string]>
Code:
Imports System.Text.RegularExpressions
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim rx As New Regex("[<]a[\s][\w\W]*[href=](?<word>\S*)[\s\W\w]*[>]", _
RegexOptions.Compiled Or RegexOptions.IgnoreCase)
Dim text As String = "<a href=http:// name=as>"
Dim matches As MatchCollection = rx.Matches(text)
For Each m As Match In matches
MsgBox(m.Groups("word").Value)
Next
End Sub
End Class
Comment