Hello, so i'm having problem with Regex. I'm trying to use to put names in a checkboxlist. But the page where i want the names from have to be accesed by login in on the website. But the regex doesnt read from the VB WebBrowser it reads from... the internet(?) SO long story Short "How can i make A regex find the names from The VB Webbrowser, So i can log in on the VB WebBrowser and navigate to the page to find the names. Excuse me if i'm bad at explaining.

Also here is my general Regex code i dont know if it's suitable, as it hasn't really worked for places other than where it was used in the Video Tutorial i saw (...Runescape.) I don't play runescape By the way.

Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://services.runescape.com/m=itemdb_rs/frontpage.ws")
        Dim response As System.Net.HttpWebResponse = request.GetResponse
        Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())

        Dim rssourcecode As String = sr.ReadToEnd

        Dim r As New System.Text.RegularExpressions.Regex("<img name=""object"" src=""http://services.runescape.com/m=itemdb_rs/.*"" alt="".*"">")
        Dim matches As MatchCollection = r.Matches(rssourcecode)

        For Each itemcode As Match In matches


and ofcourse

Imports System.Text.RegularExpressions

at the very top.

Thank you in advance :)

6 Years
Discussion Span
Last Post by DoctorGiraffe

If you just need to extract data from a webpage, see if this helps to extract the "Tags" from the "Tag Cloud" of this page.
New Project, 1 ListBox, 1 WebBrowser.

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub

    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        getItems(WebBrowser1.Document.Body.InnerHtml.Split(vbCrLf), ListBox1)
    End Sub

    Private Sub getItems(ByVal arLines() As String, ByVal selectedListBox As ListBox)
        selectedListBox.Items.Clear() '// Clear in case the webpage reloads.
        For i As Integer = 0 To arLines.Length - 1 '// Loop thru all Strings in the Array.
            If arLines(i).Contains("<DIV class=tagcloud>") Then '// Locate the String that .Contains...
                Dim arTemp() As String = arLines(i).Split(">") '// .Split the entire String into Arrays.
                For Each itm As String In arTemp '// Loop thru all Strings in the Array.
                    If itm.EndsWith("</A") Then '// check if String .EndsWith("</A")
                        itm = itm.Replace("</A", "") '// Remove the HTML Code from String.
                        selectedListBox.Items.Add(itm) '// add Tag Name to ListBox.
                    End If
                Exit For '// Exit the Loop.
            End If
    End Sub
End Class
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.