Skip to content

Instantly share code, notes, and snippets.

@jonschoning
Created August 16, 2011 21:30
Show Gist options
  • Save jonschoning/1150224 to your computer and use it in GitHub Desktop.
Save jonschoning/1150224 to your computer and use it in GitHub Desktop.
regex.bas
Attribute VB_Name = "Module1"
Function RegexMatch(Value As String, Pattern As String, Optional IgnoreCase As Boolean = False)
Dim r As New VBScript_RegExp_55.RegExp
r.Pattern = Pattern
r.IgnoreCase = IgnoreCase
RegexMatch = r.Test(Value)
End Function
Function RegexReplace(Value As String, Pattern As String, ReplaceWith As String, Optional IgnoreCase As Boolean = False)
Dim r As New VBScript_RegExp_55.RegExp
r.Pattern = Pattern
r.IgnoreCase = IgnoreCase
r.Global = True
RegexReplace = r.Replace(Value, ReplaceWith)
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment