Step: Regex (Regular Expression)

Performs a regular expression (regex) on a value, typically to extract or rearrange characters in a string. The step allows for capturing groups and only using a subset of them in the output. A useful reference for regex syntax is at

Operates on table variable values

Allows Freemarker templates to select values

  • Input Value: the value of a variable from the package table. Uses Freemarker Templates to reference values in the package table.
  • Output Variable: the name you want to store the table in. You do not need to use the Freemarker $ syntax, just the name.
  • Replace Input Variable: Check this box to replace the string in the package table with the newly-created output
  • Regex Pattern: The pattern you want to use on the Input Value. Parentheses () can be used to capture groups
    • Case Sensitive: If checked, does not change the input value before the comparison. If unchecked, the input value is converted to lower case first.
  • Results to Save: If capture groups () were used, list the ones to include in the output, or enter 0 zero to include the entire results of the pattern match
  • TRUE if the regex pattern match is successful
    • The output variable will store mutiple values in an array (list), so other steps would reference them with FreeMarker syntax like ${networkid[0]} and ${networkid[1]} in the example used above (note that the list starts at zero).
    • How the result appears in the Inventory view

      In the example used above, the regex captures each of the four segments of an IP Address. Only the first two (1,2) captures will be output. If the value of ${ipaddress[0][0]} was "", for example, the output from this step would be:

      • ${networkid[0]} = "192"
      • ${networkid[1]} = "168"
  • FALSE if the regex pattern does not match anything in the input value
  • Regex Cheetsheet
  • The use of the Inventory view is recommended for troubleshooting
  • step/regex
  • Last modified: 2018/10/30 15:30