Prototype: countclassesmatching(regex, tag1, tag2, ...)

Return type: int

Description: Count the number of defined classes matching regex.

This function matches classes, using an anchored regular expression that should match the whole line. The function returns the number of classes matched.

You can optionally restrict the search by tags, which you can list after the regular expression.


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

bundle agent example
      # this is anchored, so you need .* to match multiple things
      "num" int => countclassesmatching("cfengine");
      "hardcount" int => countclassesmatching(".*", "hardclass");
      "Found $(num) classes matching";


R: Found 1 classes matching

See also: classes defined via augments, classmatch(), classesmatching()