Pattern matching: operators and wildcards

Wildcards and operators can be used in many Tasks but also in Team rules, conditions and evaluators to define a set of objects, rather than naming a specific one.

Examples

Use a pattern such as LIKE 10.1.7.* instead of a fixed list of IP addresses as a Team Rule. This rule will not only be applied to all existing Agents whose IP address match the specified pattern: new Agents are automatically added to the list if their IP addresses match the pattern provided.

Add a condition with an expression using an operator in combination with a pattern: if the Fully Qualified Domain Name LIKE *RES.NL then execute this Module.

Operators

Operator

Stands for

=

equals

>

larger/more than

<

smaller/less than

<=

equal to or smaller/less than

>=

equal to or larger/more than

<>

larger/more than or smaller/less than (but not equal to)

LIKE

matches a given pattern. If a value matches the pattern, the operator returns True; otherwise, it returns False.

Always use LIKE if the value contains a wildcard. For example, when setting a Team Rule based on an IP address, set the Operator LIKE and the value 10.1.7.*

LIKE ensures that the wildcard is interpreted as such. With other operators, the value is interpreted literally. (So the Team Rule in the above-mentioned example would never be met, because 10.1.7.* is not a valid IP addresses that can exist in any environment.)

NOT LIKE

does not match the pattern. If a value does not match the pattern, the operator returns True; otherwise, it returns False.

Wildcard characters

Wildcards can only be used in combination with the operators LIKE and NOT LIKE. Combinations of wildcard characters are allowed.

Character

Stands for

Example

?

Any single character

ba? matches bat, bad, bag, ba1, ba2, ...

*

Zero or more characters

 

Unix/Linux and Mac OS X Tasks: Zero or more occurrences of the previous character

a*a matches andromeda, aga, aa, a888a, a0a, ...

 

Unix/Linux and Mac OS X Tasks: * cannot be used on its own as a wildcard pattern matching expression – it must be preceded with another character, for example tre* matches tree (2 occurrences of e), tread (1 occurrence of e) and trough (0 occurrences of e).

#

Any single digit (0-9)

a#b matches a1b, a2b, ..., a9b but not aga, aka, ...

!

Excludes a pattern

a[!1-8] matches aa, ab, a9, ..., but not a1, a2, ...

[charlist]

Any single character in charlist

a[A-L] matches aa, ab, ... al but not am, an, ...

[!charlist]

Any single character not in charlist

a[!A-L] matches am, an, ..., az but not aa, ab, ... al