If you want to use RegEx like in many other languages you must simply do the following :
- Add a reference to : Microsoft VBScript Regular Expressions 5.5
File : \System32\vbscript.dll
GeSHi (vb):
'Prepare a regular expression object
Dim myRegExp As RegExp
Dim myMatches As MatchCollection
Dim myMatch As Match
Set myRegExp = New RegExp
myRegExp.IgnoreCase = True
myRegExp.Global = True
myRegExp.Pattern = "regex"
Set myMatches = myRegExp.Execute(subjectString)
For Each myMatch in myMatches
MsgBox(myMatch.Value)
Next
Created by GeSHI 1.0.7.20
Copy+Paste-Ready-To-Use-Code

GeSHi (vb):
Public Function sParseHref(sMatch As String, sHTML As String, Optional sClass As String = "", Optional MultiURLz As Boolean = False) As String
'returns a url that matches your sMatch string
Dim sPat As String, oHrefMatch As Variant
Dim objSrc As Variant, sHref As String
Dim rReg As RegExp
Dim oAnchorTag As Variant
Dim sHrefPat As String, objMatch As Variant
sParseHref = ""
Set rReg = New RegExp
sPat = "<A\s(.*?)>"
rReg.Pattern = sPat
rReg.Global = True
rReg.IgnoreCase = True
'Execute the regular expression on the raw HTML
Set oAnchorTag = rReg.Execute(sHTML)
'Step through our matches
For Each objMatch In oAnchorTag
sHrefPat = "href=""?(.*?)[\s"">]"
rReg.Pattern = sHrefPat
Set objSrc = rReg.Execute(objMatch.Value)
For Each oHrefMatch In objSrc
sHref = Trim(Replace(Replace(Replace(objMatch.Value, """", ""), "href=", "", 1, 1, 1), ">", ""))
Select Case Len(sClass)
Case 0
Case Else
If InStr(1, sHref, "class=" & sClass) = 0 Then
GoTo 2
End If
End Select
sHref = Trim(Replace(Replace(Replace(oHrefMatch.Value, """", ""), "href=", "", 1, 1, 1), ">", ""))
If InStr(1, sHref, sMatch, 1) > 0 Then
If MultiURLz = True Then
sParseHref = sParseHref & sHref & "|"
Else
sParseHref = sHref
GoTo gotit
End If
End If
DoEvents
2:
Next
Next
gotit:
Set objSrc = Nothing
Set rReg = Nothing
Set objMatch = Nothing
Set oAnchorTag = Nothing
End Function
Created by GeSHI 1.0.7.20
Usage:
GeSHi (vb):
Dim xmlHTTP As Object
Dim tmp() As String
Set xmlHTTP = CreateObject("Microsoft.XMLHTTP")
xmlHTTP.open "GET", "http://www.google.de/search?hl=de&q=visual+basic&meta="
xmlHTTP.send
Do Until xmlHTTP.readyState = 4
DoEvents
Loop
'Put all found urls in an array
tmp() = Split(sParseHref("vb", xmlHTTP.responsetext, , True), "|")
'Or just return the first found url on wikipedia
MsgBox sParseHref("wiki", xmlHTTP.responsetext)
Created by GeSHI 1.0.7.20