Patterns
Simplified Pattern Syntax
The Simplified pattern syntax is available in boom because it provides a more readable form.
In addition it allows defining names for custom variables. In most cases it is enough to have simple patterns to
match incoming indications. On the other side, this format has sensitive limitations and might be not sufficient for
real complex text processing.
Hint: The rules by which boom assigns strings to variables behaves like HP Operations Manager's
algorithm. The HP Operations manager's pattern matching algorithm always scans both the input line and the pattern definition
(including alternative expressions) from left to right. <*> expressions are assigned as few characters as possible.
<#>, <@> and <_> expressions are assigned as many characters as possible (greedy).
Example: In matching the pattern <*.var1><*.var2> against the string "test", var1 will be assigned an empty string, var2
will be assigned the string "test".
| Element | Description |
| <*> | matches all |
| <n*> | matches a sequence of 'n' arbitrary characters |
| <#> | matches a sequence of one or more digits [0-9] |
| <n#> | matches a sequence of 'n' digits character |
| <@> | matches a sequence word or digits character without separators [a-zA-Z_0-9] |
| <n@> | matches a sequence of 'n' word or digits character without separators |
| <_> | matches a sequence of separators [ \t\n\x0B\f\r] |
| <n_> | matches a sequence of 'n' separators |
| <![]> | "NOT" operator |
<*.varName> <#.varName> <@.varName> <_.varName> <[<n*>].varName> <[<n#>].varName> <[<n@>].varName> <[<n_>].varName> | Stores the matching result in the variable "varName". This variable can be used during construction of indication. To access the variable use <$varName>. |
<[aaa|bbbb]> [aaa|bbbb] | "OR" condition - allows to match "aaa" OR "bbbb". "OR" condition does not support declaration of variable directly. |
| <[<[aaa|bbbb]>].varName> | "OR" condition can be inserted in superset pattern group declaration. it allows to match "aaa" OR "bbbb" and store in the variable declared in the superset pattern group. |
| <[] -eq n> | Equal |
| <[] -ne n> | Not Equal |
| <[] -lt n> | Less Than |
| <[] -le n> | Less or Equal |
| <[] -gt n> | Greater Than |
| <[] -ge n> | Greater or Equal |
| <n -lt [] -lt n> | Open Interval |
| <n -le [] -le n> | Closed Interval |
| <n -gt [] -gt n> | Open Interval |
| <n -ge [] -ge n> | Closed Interval |
It is possible to have inner capturing groups to parse additional variables from extracted parts.
For Example:
Incoming text: --- 01/01/2008 x--x Error404 Page not found
It is necessary to extract a single message part: "Error404 Page not found" together with two sub-elements:
"404" and "Page not found" as a separate value.
The pattern <*><[Error<[<#.n><_><*.msg>]>].complete>
delivers the following result:
<$complete>=Error404 Page not found
<$dummy1>=404 Page not found
<$n>=404
<$msg>=Page not found
where dummy1 is an intermediate internal variable which is used during the calculation.
The next example shows the use case where the goal of filtering is to match messages for all
users except the following: {"root", "user1", and "user2"}.
The complexity of this task is that there are also
users available with names like: "user10", "user112".
The proposed pattern do this job by using sub-pattern is:
[user[1|2]] combined with <![root].from>
Java Patterns
Java patterns are used for the "Search Text" attribute of Indication or Hybrid Policies and a couple
of bundled Java Monitors (Opm and LogFileMonitor). The full description of a Java pattern format can be found
on Sun's Java Platform API page
(see Pattern class).
The boom Java patterns also support variables but in a slightly different way than the 'Simplified Pattern Syntax'.
By using the Java patterns you can not define custom names but you can use predefined names: <$var1>,<$var2>,<$var3>...
Hint: The rule by which the Java pattern matching algorithm assigns strings to variables is always greedy (expressions are assigned
as many characters as possible).
Short overview about the Java Pattern Syntax:
| Java Pattern Classes | Description |
| . | any character. |
| .? | any character once or not at all. |
| .* | any character zero or more times. |
| .+ | any character one or more times. |
| a+ | 'a' character one or more times. |
| .{n} | matches a sequence of 'n' characters |
| \d+ | matches a sequence of one or more digits [0-9] |
| \d{n} | matches a sequence of 'n' digits character |
| \w+ | matches a sequence word or digits character without separators [a-zA-Z_0-9] |
| \w{n} | matches a sequence of 'n' word or digits character without separators |
| \s+ | matches a sequence of separators [ \t\n\x0B\f\r] |
| \s{n} | matches a sequence of 'n' separators |
(X) where X - some pattern. i.e (\w+) | Declares a capturing group. Value of capturing group will be stored in the variable "varN", where N is a number of group in the patters started from 0. To access variable - use <$varN> |
| (?:aaa|bbbb) | "OR" condition - allows to match "aaa" OR "bbbb" as non-capturing group. |
| (aaa|bbbb) | "OR" condition - allows to match "aaa" OR "bbbb" as capturing group <$varN>. |
| [a-dA-D] | any character of set: a,b,c,d,A,B,C,D |
| [^a-dA-D] | any character except a,b,c,d,A,B,C,D |
| (.*)(?<!abc) | any string EXCEPT "abc". Second non-capturing group looks on result of first |
| (?!abc)(.*) | any string EXCEPT "abc". First non-capturing group looks on result of second |
| ((?!abc).)* | any string NOT CONTAINING "abc". |
| (?i) | switch to case insensitive pattern matching. |
| (?m) | switch to multi-line pattern matching. |
|