variable_string_match

Test the content of a string variable.

⚙️ Compatible targets: Linux

Parameters

NameDocumentation
nameComplete name of the variable being tested, like my_prefix.my_variable.

This parameter is required.
expected_matchRegex to use to test if the variable content is compliant.

This parameter is required.

Example

method: variable_string_match
params:
  expected_match: VALUE
  name: VALUE

Documentation

Test a variable content and report a success if it matched, or an error if it does not or if the variable could not be found. Regex must respect PCRE format. Please note that this method is designed to only audit a variable state. If you want to use conditions resulting from this generic method, is it recommended to use instead condition_from_variable_match which is designed for it.