classmatch

Table of Contents

Prototype: classmatch(regex)

Return type: boolean

Description: Tests whether regex matches any currently set class.

Returns true if the anchored regular expression matches any currently defined class, otherwise returns false.

Arguments:

  • text: string, in the range: .*

Example:

body common control
{
      bundlesequence  => { "example" };
}

bundle agent example
{
  classes:

      "do_it" and => { classmatch("cfengine_3.*"), "any" };

  reports:

    do_it::

      "Host matches pattern";
}

Output:

R: Host matches pattern