Oct 29, 2012 05:26 AM
(This post was last modified: Nov 8, 2015 03:12 PM by Shoсkwave.)
Hey guys this tutorial I will be showing you how to get nearly any value from a website using a regex function.
The function:
Usage:
Say we want to get a fresh proxy list from
http://www.xroxy.com/proxylist.php
We want to get the highlighted value here:
Spoiler (Click to View)
It is really simple using this function, so we get the page source either from grabbing it with a webrequest/webclient or just copying the source into a richtextbox, either way.
So here is how it is done, we see before the proxy and port there is this:
So to get all values that look like this our function will look something like this:
![[Image: 1k5bn]](https://puu.sh/1k5bn)
the ".*" means anything can be there so we grab all strings like that.
Now if we set the value's that we have just grabbed into a richtextbox it should look like this:
Spoiler (Click to View)
We have grabbed the ips but it is a mess, we have to format it using the Split() function, it is quite self explanatory, this is what our function should look like now:
![[Image: 1k5dQ]](https://puu.sh/1k5dQ)
And we have now successfully extracted the strings in ip/port format.
![[Image: 1k59U]](https://puu.sh/1k59U)
If you have any questions or problems let me know, thanks guys.
The function:
Code
Public Shared Function RegexMatch(ByVal Text As String, ByVal Regexstring As String) As MatchCollection
Dim r As New System.Text.RegularExpressions.Regex(Regexstring)
Dim matches As MatchCollection = r.Matches(Text.Trim)
Return matches
End FunctionUsage:
Code
For Each m As Match In RegexMatch(SourceCode, RegexString)
MsgBox(m.value)
NextSay we want to get a fresh proxy list from
http://www.xroxy.com/proxylist.php
We want to get the highlighted value here:
Spoiler (Click to View)
It is really simple using this function, so we get the page source either from grabbing it with a webrequest/webclient or just copying the source into a richtextbox, either way.
So here is how it is done, we see before the proxy and port there is this:
Code
proxy:name=XROXY proxy&host=121.52.210.22&port=28889the ".*" means anything can be there so we grab all strings like that.
Now if we set the value's that we have just grabbed into a richtextbox it should look like this:
Spoiler (Click to View)
We have grabbed the ips but it is a mess, we have to format it using the Split() function, it is quite self explanatory, this is what our function should look like now:
And we have now successfully extracted the strings in ip/port format.
If you have any questions or problems let me know, thanks guys.



![[Image: eQhTFwh.gif]](https://i.imgur.com/eQhTFwh.gif)

![[Image: 1riOqZa.png]](https://i.imgur.com/1riOqZa.png)