954,535 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Regex Issue

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

linezero
Newbie Poster
17 posts since Nov 2010
Reputation Points: 11
Solved Threads: 0
 

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
codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: