Start New Discussion within our Software Development Community

I am trying to move a match from a match collection to another listbox as string. here is my regex code

Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://localhost/pos/leftpanel.html")
        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("http://localhost/booksmodule/ListContent.php?case=.*&funcfor=.*&funcmod=.*&catid=LM3334443&refid=.*&ccshowid=.*")


Dim matches As MatchCollection = r.Matches(rssourcecode)


        For Each itemcode As Match In matches

            ListBox1.Items.Add(itemcode)

        Next

I want to copy the listbox1 items that are added as match to another listbox which is listbox2 as string instead of match

Comments
well written post

If you were getting the Conversion from type 'Match' to type 'String' is not valid. , you just needed to get the .Value of the Match .

For Each itemcode As Match In matches
            ListBox1.Items.Add(itemcode.Value)
        Next
This question has already been answered. Start a new discussion instead.