StringTools[WildcardMatch] - match strings against glob-style patterns
|
Calling Sequence
|
|
WildcardMatch( pattern, text )
|
|
Parameters
|
|
pattern
|
-
|
Maple string
|
text
|
-
|
Maple string
|
|
|
|
|
Description
|
|
•
|
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
|
|
[ccl]
|
matches any character in the character class
|
ccl
|
|
|
•
|
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 , which matches any of the characters , , , or . Character classes can include character ranges, which are defined by their order in the US-ASCII character encoding. For example, the character class matches any lowercase letter, and 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, 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.
|
|
|
Examples
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
>
|
|
| (6) |
>
|
|
| (7) |
>
|
|
| (8) |
>
|
|
| (9) |
>
|
|
| (10) |
>
|
|
| (11) |
>
|
|
| (12) |
>
|
|
| (13) |
>
|
|
| (14) |
>
|
|
| (15) |
>
|
|
| (16) |
>
|
|
| (17) |
>
|
|
| (18) |
Escape the opening square bracket ([) in the pattern using two backslashes to interpret it as a normal character.
>
|
|
| (19) |
|
|
Download Help Document
Was this information helpful?