This code matches a given string against a pattern which may contain the well known wildcards * and ?, whereas * represents any number of characters, including none, and ? represents any single character. You may want to paste the code into a class module :)
Inputs
Name as String, Pattern as String. Name is the String you want to match against Pattern.
Assumes
MatchCase() is the case-sensitive worker function. It makes usage of PreparePattern() to escape the characters # and [ (read Side effects).
Match() is just a wrapper for MatchCase() which does a LCase() on both Name and Pattern parameters.
Returns
Returns Boolean True if String matches for Pattern, else returns Boolean False.
Side Effects
This code is written specifically for usage in an IRC bot, thus does escape certain chars which are recognized by the "Like" operator, which this code builds on. Namely, # and [ are taken literally rather than being interpreted as wildcards.