Excel VBA – LIKE

Sub usingLIKE()

    ' first character is B, then any character then capital letter "T"
    Debug.Print "Batman" Like "B?T*"    ' Returns True.
    Debug.Print "Catwoman" Like "B?T*"    ' Returns False.

End Sub


Sub usingLIKE_ver2()

    Debug.Print "ab" Like "a*b"    ' Returns True.
    Debug.Print "a*b" Like "a[*]b"    ' Returns True.

End Sub

Sub usingLIKE_ver3()

    ' # mean any single digit (0-9)
    Debug.Print "a2a" Like "a#a"    ' Returns True.
    
    '[ !charlist ]   Any single character not in charlist.
    ' start with a
    ' follow by any character between X to Z
    ' follow by any single digit
    ' follow by any character not in c to e
    Debug.Print "aX5b" Like "a[X-Z]#[!c-e]"    ' Returns True.

End Sub