Regular expressions in TPL search strings
The regular expression defines the pattern to be searched for in selected SYSOUTs (SYSOUT that is matched by a selector or subselector rule).
Output Manager supports
most POSIX-compliant regular expressions in the text-matching search
string of TPL rules. The following section covers the basic character
class definitions and special characters used in such regular expressions,
and includes examples on how regular expressions can be used in the
TPL search string value.
Note: This section is meant as a high-level
guideline, it is not meant as a guide in writing regular expressions,
nor does it include an exhaustive list of regular expression special
characters. For more information, refer to the UNIX® System Services Command Reference manual.
Several regular expressions can be strung together to form a larger, more exclusive regular expression. Use parentheses and square brackets to define the scope and precedence of the smaller regular expression segments.
The following special characters can be used to build
text-matching regular expressions for Output Manager TPL search strings:
- . (dot character) Matches any single character. Within POSIX bracket expressions, the dot character matches a literal dot. For example, a.c matches "abc", etc.
- * (asterisk) A quantifying special character used to specify that the preceding element can occur zero or more times. For example, "ac*" will match "accounts", "actual", and "advertising".
- ? (question mark) A quantifying special character used to specify that the preceding element can occur zero or one times. For example, "accounts?" will match both "account" and "accounts".
- + (plus sign) A quantifying special character used to specify that the preceding element can occur one or more times. For example, "ac+" will match both "accounts" and "actual", but will not match "advertising".
- | (vertical bar, hex 6A or 4F equivalent) specifies the boolean "OR", used to signify alternative characters, strings, and expressions. Matches either the expression before or the expression after the operator.
- [ ] (square brackets) Specifies a POSIX Character Class Definition.Note: Square brackets (hex AD and BD in EBCDIC-1047, and hex BA and BB in EBCDIC-37) are supported only in code pages 1047 and 37.The following is a list of supported POSIX character classes that you can use in your search expression:
- [:alnum:] Match any alphanumeric character (alphabetic or digit).
- [:alpha:] Match any alphabetic character.
- [:digit:] Match any digit character (0 to 9). (PERL equivalent: \d)
- [:lower:] Match any lowercase alphabetic character.
- [:upper:] Match any uppercase alphabetic character.
- [:space:] Match whitespace characters (PERL equivalent: \s)
- [:word:] Matches alphanumeric characters plus "_". (PERL equivalent: \w)
- [:xdigit:] Match hexadecimal digits.
Restriction: The following character class definitions are NOT supported: [:blank:], [:cntrl:], [:graph:], [:print:], and [:punct:]. - ( ) (parenthesis) Defines a marked subexpression used to group parts of the expression together to define the scope and precedence of the operators in the regular expression.
- {m,n} Matches the preceding element at least m and not more than n times. For example, a{3,5} matches only "aaa", "aaaa", and "aaaaa".
- \ (backslash) - This escape character specifies that the special character following it is to be matched literally, not be used as a special character. For example, \. only matches a dot character, and \\ matches a literal \ character.
Restriction: The $, and \n regular expression special
characters are NOT supported.
The search pattern will be used to match the beginning of the input line unless otherwise specified. To specify that the search string should be a "floating match", and match a pattern anywhere on the line, use ".*" before the string. For example: ".*ABC" means "zero or more of any character, followed by ABC", and will match "ABC" anywhere on a line.