A wildcard pattern is a series of characters that are matched against incoming character strings. You can use these patterns when you define pattern-matching criteria.

Matching is done strictly from left to right, one character or basic wildcard pattern at a time. Basic wildcard patterns are defined in Table Basic wildcard patterns. Characters that are not part of match constructs match themselves. The pattern and the incoming string must match completely. For example, the pattern abcd does not match the input abcde or abc.

A compound wildcard pattern consists of one or more basic wildcard patterns separated by ampersand (&) or tilde (~) characters. A compound wildcard pattern is matched by attempting to match each of its component’s basic wildcard patterns against the entire input string. Compound wildcard patterns are listed in Table Compound wildcard patterns.

If the first character of a compound wildcard pattern is an ampersand (&) or tilde (~) character, the compound is interpreted as if an asterisk (*) appeared at the beginning of the pattern. For example, the pattern ~*[0-9]* matches any string that does not contain any digits.

  • A trailing instance of an ampersand character (&) can only match the empty string.
  • A trailing instance of a tilde character (~) can be read as “except for the empty string.”
Note: Spaces are interpreted as characters and are subject to matching even if they are adjacent to operators such as &.