|
-
Aug 16th, 2010, 03:05 PM
#1
Thread Starter
Lively Member
[RESOLVED] Regex Help
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:
Code:
http://www.facebook.com/profile.php?id=100001473886&ref=search
I just need the 100001473886
-
Aug 16th, 2010, 04:04 PM
#2
New Member
Re: Regex Help
Tddupre,
Try this:
Code:
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
Hope this helps
-
Aug 16th, 2010, 04:13 PM
#3
Thread Starter
Lively Member
Re: Regex Help
 Originally Posted by Firestarter_75
Tddupre,
Try this:
Code:
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
Hope this helps
this does help, but i need it to search the entire html text and find the number
-
Aug 16th, 2010, 04:26 PM
#4
New Member
Re: Regex Help
Have you tried this example?
Have you tried changing the searchstring to something similar:
Code:
Dim searchstring As String = WebBrowser1.DocumentText
-
Aug 16th, 2010, 04:55 PM
#5
Thread Starter
Lively Member
Re: Regex Help
 Originally Posted by Firestarter_75
Have you tried this example?
Have you tried changing the searchstring to something similar:
Code:
Dim searchstring As String = WebBrowser1.DocumentText
yea i tried that, but it came up with no results
-
Aug 16th, 2010, 06:14 PM
#6
Frenzied Member
Re: Regex Help
Try this as your regular expression:
Last edited by Zach_VB6; Aug 18th, 2010 at 06:24 PM.
-
Aug 17th, 2010, 07:59 AM
#7
Re: Regex Help
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.
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|