Pattern Matching

CDO Rendering library Pattern objects support the WILDMAT syntax of pattern matching. The WILDMAT format was developed to provide a uniform mechanism for matching patterns in the same manner that the UNIX shell matches file names. WILDMAT works as follows:

There are five pattern-matching operations other than a strict one-to-one match between the pattern and the source that must be checked for a match. The first is an asterisk (*) to match any sequence of zero or more characters. The second is a question mark (?) to match any single character.

The third operation specifies a specific set of characters. The set is specified as a list of characters, or as a range of characters where the beginning and end of the range are separated by a minus (or hyphen) character, or as any combination of lists and ranges. The hyphen can also be included in the range as a character it if is at the beginning or end of the range. This set is enclosed in square brackets. The close square bracket (]) may be used in a range if it is the first character in the set.

The fourth operation allows you to exclude characters from the set and is specified by adding a caret character (^) at the beginning of the test string just inside the open square bracket. The final operation uses the backslash (\) character to invalidate the special meaning of an open square bracket ([), the asterisk, or the question mark.

Except for characters in a specified range, all patterns in the CDO Rendering library are matched in a case-insensitive fashion. Example patterns are listed in the following table.

Examples of Valid WILDMAT Patterns

Pattern Matches
a??d Any four-character string that begins with "a" (or "A") and ends with "d" (or "D").
*bdc Any string that ends with the string "bdc" (any combination of case, without quotes).
[0-9a-zA-Z] Any alphanumeric character (in English).
[^]-] Any character other than a close square bracket or a minus sign/dash.