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.

Outcome conditions

You need to replace ${name} with its actual canonified value.

  • ✅ Ok: variable_string_match_${name}_ok
    • ☑️ Already compliant: variable_string_match_${name}_kept
    • 🟨 Repaired: variable_string_match_${name}_repaired
  • ❌ Error: variable_string_match_${name}_error

Example

method: variable_string_match
params:
  name: VALUE
  expected_match: 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.