MatchRegexV2

Extracts regex data from the provided text. The script support groups and looping.

python · Common Scripts

Details

IDMatchRegexV2
Languagepython
From Version5.0.0
Docker Imagedemisto/python3:3.12.13.10404775
TagsUtility

README

Extracts regex data from a given text. This supports groups and looping as well.

Script Data


Name Description
Script Type python3
Tags Utility

Inputs


Argument Name Description
data The text date to extract the regex from.
regex The regex to match and extract. Take into account that data taken from context data contains special characters which are not visible, such as \n and \b.
group The matching group to return. If nothing is provided the full match will be returned. The group value should start at 1.
contextKey The context key to populate with the result.
flags The regex flags to match. The default is “-gim”.

Outputs


Path Description Type
MatchRegex.results List of Regex matches string
args:
- name: data
  required: true
  default: true
  description: The text data from which to extract from.
- name: regex
  required: true
  description: The regex to match and extract. Take into account that data taken from context data contains special characters which are not visible, such as \n and \b.
- name: group
  description: The matching group to return. If no group is provided the full match will be returned. The group value should start at 1.
- name: contextKey
  description: The context key to populate with the result.
- name: flags
  description: The regex flags to match. Default is "gim".
  defaultValue: gim
comment: Extracts regex data from the provided text. The script support groups and looping.
commonfields:
  id: MatchRegexV2
  version: -1
name: MatchRegexV2
outputs:
- contextPath: MatchRegex.results
  description: List of regex matches.
  type: string
script: '-'
scripttarget: 0
tags:
- Utility
timeout: '0'
type: python
subtype: python3
dockerimage: demisto/python3:3.12.13.10404775
fromversion: 5.0.0
tests:
- No tests (auto formatted)