Examples of pattern matching
This section describes how to use pattern matching in Text – ID and Text String fields.
Example 1
For this example, consider the message:
If you want a Rule to fire only for the message DFH346I that contains ABCD anywhere in the text, enter the selection criteria on the Rule Selection Criteria panel:
anywhere in the text, enter the selection criteria on the Rule Selection
Criteria panel:
Text Description:
Text-ID ==> DFH3461I First word of event
Text String ==> (Enter Below):
DFH3461I*ABCD*
Example 2
In this example, the Rule matches any message where the first word:
- is 7 characters long and starts with INIT
- has three positions containing characters (not blanks)
- has the word INACTIVE followed anywhere in the character string by the word MISSION
Text ID ==> INIT+++ First word of event
Text String ==> (Enter Below): Text string (incl. Text-ID)
INIT+++ *INACTIVE*MISSION*
Example 3
In this example, the Rule matches any message where the first word:
- starts with INIT
- has three positions containing characters (not blanks)
- has the word INACTIVE followed at the end of the character string by the word MISSION
Text ID ==> INIT+++ First word of event
Text String ==> (Enter Below): Text string (incl. Text-ID)
INIT+++ *INACTIVE*MISSION
Example 4
For better performance, use wildcard characters to widen or narrow the matching criteria as needed.
If you want a Rule that fires for all error messages and all error messages begin with ERR, you can write a Rule with wildcards instead of creating a Rule for every error message. The following Rule matches any message where the first word begins with ERR:
Text ID ==> ERR* First word of event
Text String ==> (Enter Below): Text string (incl. Text-ID)
To narrow the matching criteria, you could change the Text-ID field to match only messages that begin with IM9161I and also contain the word STARTED:
Text-ID ==> IM9161I
Text String ==> (Enter Below)
IM9161I *STARTED*
Examples of pattern matches
Table 1 shows some additional examples of pattern matches.
Table 1. Example of pattern matches
Character String | Pattern | Results |
---|---|---|
ABCDEF | ABC++F | Match |
ABCDEF | ABC+F | No match |
ABCDEF | A* | Match |
ABCDEF | *D+F | Match |
ABCDEF | A+C* | Match |
ABCDEF | A*F | Match |
ABCDEF | A*+F | Match |
ABCDEF | A+FF | No match |
ABCDEF | A*BCDEF | Match |
ABCDEF | A+B* | No match |
ABCDEF | 'A*BCDEF' | No match |
ABCDEF | ¬XYZ | Match |
ABCDEF | ¬*BCD* | No match |