Regular expressions
Regular expressions (or regex) can be used in wildcard SLCs and other IBM® Sterling Control Center Monitor entities to match text or numeric strings that follow a particular pattern. They consist of normal characters and special characters. Normal characters are uppercase and lowercase letters and numbers. Special characters have specific meanings in the expression.
For example, the regular expression ABCDEF contains only normal characters. When used as a match criterion, it will match only ABCDEF text strings. The regular expression [ABCDEF] contains normal characters and special characters (the brackets). It will match any text string that includes A, B, C, D, E, or F.
Regular expressions can be very complex. This topic describes basic expression characters and some simple examples for IBM Sterling Control Center Monitor. If you want to learn more about regular expressions, an Internet search on the terms “regular expression” or “regex” will provide many sites that explain regular expressions in greater detail.
The following table lists some common regular expression special characters and examples. Multiple special characters can be used in the same expression to create more criteria.
Special Character | Description | Examples |
---|---|---|
[ ] | Matches any character between the brackets. Ranges are specified by a hyphen ([a-z], [0-9]). | Proc4[123] matches the strings Proc41, Proc42,
and Proc43. Proc4[a-e]7 matches the strings Proc4a7, Proc4b7, Proc4c7, Proc4d7, and Proc4e7. |
[^] | Matches any character not appearing between the brackets. Ranges are specified by a hyphen ([a-z], [0-9]). | Proc4[^789] matches all strings that contain Proc4, except for strings containing Proc47, Proc48, or Proc49. |
. (period) | Matches any single character. | Proc4.567 matches the strings Proc41567, Proc42567, Proc4a567, and so on. It does not match Proc412567. |
+ (plus) | Matches strings containing one or more occurrences of the character immediately preceding the plus sign. | Proc456+ matches Proc456, Proc4566, Proc45666 and so on. |
* (asterisk) | Matches strings containing zero or more occurrences of the character preceding the asterisk. The search treats the character preceding the asterisk as optional. | Proc456* matches Proc45, Proc456, Proc4566, Proc45666 and so on. |
? | Matches strings containing zero or one occurrence of the character immediately preceding the question mark. The character preceding the question mark is treated as optional by the search. | Proc456? matches Proc45 and Proc456. Proc4[5-8]? matches Proc4, Proc45, Proc46, Proc47, and Proc48. |
| (pipe) | Matches the characters on either side of the pipe. | Proc456|Proc459|Proc460 matches Proc456, Proc459, or Proc460. |
\ | Escape character that converts a special character to a normal character. | Node\.Atlanta matches Node.Atlanta. |
(?i) | Used to control case sensitivity. This inline modifier affects all characters to the right and in the same enclosing group. Affected characters are allowed to be case insensitive. | In the pattern w ( x (?i) y) z, only the letter y is allowed to be case insensitive. |