(wcmatch string pattern)
The wcmatch function allows a wild card search for a pattern match on a string supplied to the function.
pattern
Wild card pattern match to be performed on string. The pattern may contain these wild card characters:
| Wild Card Character | Meaning |
|---|---|
| # | Single numeric digit |
| @ | Single alphabetical character |
| . | Single non-alphabetical character |
| * | Series of characters, including "" |
| ? | Any single character |
| ~ | If ~ (tilde) is the first character in the pattern, the function matches anything except the pattern |
| [...] | The function matches any one of the characters enclosed |
| [~...] | The function matches any single character not enclosed |
| - | Used inside brackets to specify a range for a single character |
| , | Separator for two patterns |
| ' | Escapes special characters, reads next character literally |
If a match is found, the function returns T; otherwise, the function returns nil.
Examples
: (wcmatch "a1" "a*")
T
: (wcmatch "a1" "a@")
nil
: (wcmatch "a1" "a.")
T
: (wcmatch "a1" "a[1-12]")
T
: (wcmatch "a1" "a[~1]")
nil
: (wcmatch "a1" "a3,a2,a1")
T
: (wcmatch "a1" "a?")
T