Created
October 16, 2011 16:29
-
-
Save zloydadka/1291112 to your computer and use it in GitHub Desktop.
RegExp in VBA examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Test() | |
Const strTest As String = "qwerty123456uiops" | |
MsgBox RE6(strTest) | |
End Sub | |
Function RE6(strData As String) As String | |
Dim RE As Object, REMatches As Object | |
Set RE = CreateObject("vbscript.regexp") | |
With RE | |
.MultiLine = False | |
.Global = False | |
.IgnoreCase = True | |
.Pattern = "[0-9][0-9][0-9][0-9][0-9][0-9]" | |
End With | |
Set REMatches = RE.Execute(strData) | |
RE6 = REMatches(0) | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment