'accepts * style wildcards
Function acceptExpr(ByVal strTest, find) As Boolean
'these next 3 lines make it understand diff between
'appearing in beginning and end of strings
strTest = Chr(5) & strTest & Chr(5)
If Left(find, 1) <> "*" Then find = Chr(5) & find
If Right(find, 1) <> "*" Then find = find & Chr(5)
If InStr(find, "*") > 0 Then tmp = Split(find, "*") _
Else push tmp, find
Dim t As Integer, f As Integer
For i = 0 To UBound(tmp)
If tmp(i) <> Empty Then
t = t + 1
X = InStr(1, strTest, tmp(i), vbTextCompare)
If X > 0 Then f = f + 1
End If
Next
If (t = f And t > 0) Or find = "*" Then acceptExpr = True
End Function
Sub push(ary, value) 'modifies parent array
On Error GoTo fresh
ReDim Preserve ary(UBound(ary) + 1)
ary(UBound(ary)) = value
Exit Sub
fresh: ReDim ary(0): ary(0) = value
End Sub