Pattern matching, wildcards and operators

In many Tasks, but also in Team rules, Conditions, and Evaluators, wildcards and operators can be used to define a set of objects, rather than naming a specific one. Wildcards can only be used in combination with the operators LIKE and NOT LIKE.

For example, you can 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.

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.

Available wildcard characters (combinations are allowed)

Character

Stands for

Example

?

Any single character

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

*

Zero or more characters

 

Unix/Linux and macOS Tasks: Zero or more occurrences of the previous character

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

 

Unix/Linux and macOS 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

Pattern matching

In several windows where wildcard characters and operators are allowed, you can click Pattern Matching. This opens a window where you can test whether a pattern matches what you thought it would match.

  • In the Tasks Apply Registry Settings and Perform File Operations, pattern matching functions is somewhat differently. See the Help for those specific Tasks.
  • In the Tasks Unix/Linux and macOS, pattern matching is done using regular expressions.
  • If items in your Microsoft Windows environment contain special characters in their name ([,*,?, #, etc), you can use these items in Ivanti Automation by enclosing the special characters in square brackets. For example, if the name of an item is "test*" and you use this item in a filter, "test[*]" will match the item "test*". Please note that if you filter on "test*" in Ivanti Automation (so, without the square brackets), the special character "*" will be treated as a wildcard character: "test*" will then match all items starting with "test".