Prototype: reglist(list, regex)

Return type: boolean

Description: Returns whether the anchored regular expression regex matches any item in list.

This function can accept many types of data parameters.

Arguments:

  • list: string - CFEngine variable identifier or inline JSON - in the range: .*
  • regex: regular expression - Regular expression - in the range: .*

Example:

Output:

code
R: 127.0.0.1 is NOT currently set as a nameserver

In the example above, the IP address in $(sys.ipv4[eth0]) must be escaped, so that the (.) characters in the IP address are not interpreted as the regular expression "match any" characters.

History: The collecting function behavior was added in 3.9.

See also: getindices(), getvalues(), about collecting functions, and data documentation.