Skip to main content


This Script is part of the Filters And Transformers Pack.#

Extraction of all matches from a specified regular expression pattern from a provided string. Returns an array of results. This differs from RegexGroups in several ways:

  • It returns all matches of the specified pattern, not just specific groups. This is useful for extracting things using a pattern where the content of the source string is indeterminate, such as extracting all email addresses.
  • Some "convenience" arguments have been added to enhance usability: multi-line, ignore_case, period_matches_newline
  • Added a new argument, "error_if_no_match". The script will not ordinarily throw an error if a match is not found but if not using as a transformer within a playbook, it may, in certain limited circumstances, be desirable to throw an error if the expression doesn't match.
  • It uses the 'regex' library, which supports more some more advanced regex functionality than the standard 're' library. For more info, see

Script Data#

Script Typepython3
Tagstransformer, string
Cortex XSOAR Version5.0.0


Argument NameDescription
valueText to match against, e.g., The quick brown fox.
regexRegex pattern to search (in Python), e.g., (The)\s(quick).*(fox).
multi_lineProcess value in multiline mode. See more information on re.MULTILINE, see
ignore_caseWhether character matching will be case-insensitive. Default is "false".
period_matches_newlineWhether to make the '.' character also match a new line. Default is "false".
error_if_no_matchOnly set to 'true' if used in a playbook task and you want that failure will return an error.
unpack_matchesWhether to unpack the tuple values of results. Default is "false".


There are no outputs for this script.