match strings against glob-style patterns
WildcardMatch( pattern, text )
The WildcardMatch(pattern, text) command provides glob-style pattern matching. Given a pattern containing wildcards, and an input string text, WildcardMatch returns the value true if the given text matches the pattern, and returns the value false otherwise.
The wildcards are similar to those used in filename globbing in UNIX shells. These are defined as follows.
matches zero or more characters
matches one character
matches any character in the character class
Character classes denote sets of characters to match. A character class is enclosed in square brackets (). It can be a simple list of characters, such as aeiou, which matches any of the characters a, e, i, o or u. Character classes can include character ranges, which are defined by their order in the US-ASCII character encoding. For example, the character class [a-z] matches any lowercase letter, and [0-9] matches any digit. A character class can be negated (or complemented) by including the character ^ as the first within the character class. Thus, for instance, [^0−9] denotes the set of characters other than the digits. The "^" character has this special complementing meaning only when it appears as the first character in a character class. If it appears elsewhere, then it stands for itself. To include a hyphen character "-" in a character class, write it as the first character in the character class, or include it in a character range. To include the character "]" in a character class, write it as the first character following the opening bracket, or include it in a character range. If you want to exclude the character "]" from a character class, write it as the first character after the "^" as, for example, in "[^]]".
Pattern matching facilities provided by the StringTools package include regular expression matching (see StringTools[RegMatch]) and fast string search (see StringTools[Search] and searchtext).
All of the StringTools package commands treat strings as (null-terminated) sequences of 8-bit (ASCII) characters. Thus, there is no support for multibyte character encodings, such as unicode encodings.
Escape the opening square bracket ([) in the pattern using two backslashes to interpret it as a normal character.
Download Help Document