KI_PMATCH
| Argument | Enumeration | Purpose |
|---|---|---|
| sample$ | File name | |
| pattern$ | Pattern containing "?", "*" or "[]" | |
| result | 1 for a match, 0 for no match |
KI_PMATCH
This routine performs case-sensitive pattern matching on the string passed in sample$ using the expression in pattern$ which can be a mixture of a literal characters or metacharacters. The status is TRUE if they match and FALSE if there is no match. Matching is done with a shell pattern matching algorithm rather than a true Unix regular expression. Supported metacharacters are:
| Metacharacter | Purpose |
|---|---|
| [s] | Any character in the set s where s is either a list of single chararacters e.g. [abcABC] or a range separated with a - e.g. [a-c] or some combination |
| [!s] | Any character not in the set s. |
| ? | matches a single character |
| * | matches zero or more characters |
Examples:
| pattern$ | Comment |
|---|---|
| * | Always matches any string |
| XYZ* | TRUE if string begins with XYZ |
| *XYZ | TRUE if string ends with XYZ |
| *XYZ* | TRUE if string contains XYZ |
| [0-9]* | TRUE if string begins with a decimal digit |