Extract all regex matches

Supported in: Batch

Extract all instances of a regex match into an array.

Expression categories: Regex, String

Declared arguments

  • Expression - String to extract values from.
    Expression<String>
  • Group - Group number to extract. If 0, the whole regex pattern is matched.
    Literal<Integer>
  • Pattern - Regex expression of pattern to match.
    Regex

Output type: Array<String>

Examples

Example 1: Base case

Description: Extract the first two initials from each code. Argument values:

  • Expression: MT-112, XB-967
  • Group: 1
  • Pattern: (\w\w)(-)

Output: [ MT, XB ]


Example 2: Null case

Description: Null inputs give null outputs. Argument values:

  • Expression: null
  • Group: 1
  • Pattern: (\w\w)(-)

Output: null