Public Function MatchesPattern( _
strInputTest As String, _
strInputPattern As String, _
Optional IgnoreCase As Boolean = True, _
Optional IsGlobal As Boolean = True _
) As Boolean
On Error GoTo Catch
Dim objRegExp As New RegExp
Set objRegExp = Nothing
objRegExp.IgnoreCase = IgnoreCase
objRegExp.Global = IsGlobal
objRegExp.Pattern = strInputPattern
MatchesPattern = objRegExp.Test( _
strInputTest _
)
Set objRegExp = Nothing
Exit Function
Catch:
Set objRegExp = Nothing
End Function
MatchesPattern

Leave a Reply