A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.cfengine.com/latest/reference-functions-countclassesmatching.html below:

countclassesmatching - CFEngine 3.26 Docs

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.

Example:

code

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

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

Output:

code

R: Found 1 classes matching

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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4