I need to get the number in this url which is will be contained in the webbrowser1.documenttext, there will only be one on the page
example:
I just need the 100001473886Code:http://www.facebook.com/profile.php?id=100001473886&ref=search
Printable View
I need to get the number in this url which is will be contained in the webbrowser1.documenttext, there will only be one on the page
example:
I just need the 100001473886Code:http://www.facebook.com/profile.php?id=100001473886&ref=search
Tddupre,
Try this:
Hope this helpsCode:Dim searchstring As String = "http://www.facebook.com/profile.php?id=100001473886&ref=search"
Dim idmatch As Match = Regex.Match(searchstring, "(?<=id\=)\d*(?=\&ref)")
If idmatch.Success Then
MessageBox.Show(idmatch.Value)
Else
MessageBox.Show("No match found.")
End If
Have you tried this example?
Have you tried changing the searchstring to something similar:
Code:Dim searchstring As String = WebBrowser1.DocumentText
Try this as your regular expression:
Code:id=(\d+)&?
the regex.match function returns only the first match found in the string. If you want to find all matches from a string, call regex.matches function instead and it will return a matchcollection which you can loop through each match and read the value.