info.mailtraq.com > Management > Script Functions A-Z > WildcardMatch() WildcardMatch()Compares an input string with a wildcarded expression string and returns a Boolean indicating whether or not the match was successful. Comparisons are insensitive to case in both the input and expression strings.
The expression string consists of plain text with the wildcards * (ASCII 42) and ? (ASCII 63) representing a series of unknown characters and a single unknown character respectively. The * wildcard represents zero or more characters unless matching to the right hand end of the input string when it represents one or more characters. See final two examples below for clarification and a simple workaround.
match := WildcardMatch( input , expression )
- input
- The input string
- expressionWildcarded expression to be matched against the input
- string
- match
- Boolean TRUE or FALSE indicating whether the input string matches the expression string
TRUE := WildcardMatch("The quick brown fox", "*the*")
FALSE := WildcardMatch("The quick brown fox", "*ab?de*")
TRUE := WildcardMatch("The quick brown fox", "*fo?")
FALSE := WildcardMatch("The quick brown fox", "*fox*")
Note the string in the next example is padded with a trailing space so that the final asterisk in the expression doesn't match the right hand end of the input string TRUE := WildcardMatch("The quick brown fox ", "*fox*") |