VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Wildcard Matcher

gridrun  (2 Submissions)   String Manipulation   Visual Basic 3.0   Beginner   Wed 3rd February 2021

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.

Rate Wildcard Matcher (3(3 Vote))
Wildcard Matcher.bas

Wildcard Matcher Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters