I have been stumped on this for about 3 weeks now. In the beginning me and my partner have been trying to hit this at the internal angle. only problem is different html tables are constructed different than others. We are needing to extract from multiple pages and sites so we know that Regex will be the best solution. We can use the same script for everything. This is my first time working with Regex, I got it actually extracting the very first ip[proxy].
I have no idea why it isn't extracting every one on the page. I also have to add the . in between each each octave of the ip. That is weird because I have it in the Regexpession to find the .'s.
What I'm Needing is for this to basically scan the whole page and grab all the ips
orts and add them to a listbox.
Here is my code:
Code:
Dim request As HttpWebRequest = Nothing
Dim response As HttpWebResponse = Nothing
Try
request = DirectCast(WebRequest.Create(("http://nntime.com/proxy-list-01.htm")), HttpWebRequest)
request.Accept = "*/*"
request.Method = "GET"
request.Timeout = &H2710
request.ReadWriteTimeout = &H2710
request.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"
response = DirectCast(request.GetResponse, HttpWebResponse)
Dim input As String = New StreamReader(response.GetResponseStream).ReadToEnd
Dim regex2 As New Regex("\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b\:(\d+)", RegexOptions.Multiline)
Dim match2 As Match = regex2.Match(input)
If match2.Success Then
' Me.TextBox1.Text = match2.Groups.Item(1).Value.Trim
Me.TextBox1.Text = TextBox1.Text + match2.Groups.Item(1).Value.Trim & "."
Me.TextBox1.Text = TextBox1.Text + match2.Groups.Item(2).Value.Trim & "."
Me.TextBox1.Text = TextBox1.Text + match2.Groups.Item(3).Value.Trim & "."
Me.TextBox1.Text = TextBox1.Text + match2.Groups.Item(4).Value.Trim & ":"
Me.TextBox1.Text = TextBox1.Text + match2.Groups.Item(5).Value.Trim
End If
Catch exception As Exception
Trace.WriteLine(("Get Views ex: " & exception.Message))
Finally
If (Not response Is Nothing) Then
response.Close()
End If
End Try
I need help so bad, this is the first time I have leaned towards a message box but I have no other choice.
Thanks to who ever will help.