I can't seem to figure out why my regular expressions function isn't working. Can anyone help?
[VBA]Sub t()
Debug.Print regex_match("MA-167", "[\D{2}-\d{3}]")
End Sub
Function regex_match(value As String, _
pattern As String, _
Optional multiline = False, _
Optional globl = False, _
Optional ignoreCase = False) As String

Dim re As Object, REMatches As Object

Set re = CreateObject("vbscript.regexp")

With re
.multiline = multiline
.Global = globl
.ignoreCase = ignoreCase
.pattern = pattern
End With

Set REMatches = re.Execute(value)
regex_match = REMatches(0)
End Function[/VBA]

error is here: Set REMatches = re.Execute(value)