RemoveMatches

Removes items from the given list of values if they match any of the patterns in the provided `filters`. If the match_exact argument is 'yes', direct string compare is used, otherwise the comparison is done using regex.

python · Filters And Transformers

Details

IDRemoveMatches
Languagepython
From Version6.10.0
Docker Imagedemisto/python3:3.12.13.10404775
Tagstransformer entirelist general

README

Removes items from the given list of values if they match any of the patterns in the provided filters.
If the match_exact argument is ‘yes’, direct string compare is used, otherwise the comparison is done using regex.

Example


value (Get)
[
    "https://domain1.com/some/url",
    "http://another.url.com",
    "domain2.com/faq",
    "domain3.com/login",
    "sub.domain3.com/login"
]
filters
^*.\.domain1.com/.*\n
^*.\.domain2.com/.*\n
^sub.domain3.com/.*
Result
[    
    "http://another.url.com",
    "domain3.com/login"
]

Script Data


Name Description
Script Type python3
Tags transformer, entirelist, general
Cortex XSOAR Version 6.10.0

Inputs


Argument Name Description
value The value on which the transformer is applied.
ignore_case Whether to ignore the case of the item for which you are searching. Default is “Yes”.
match_exact Whether to match the exact item in the list, or look for any string that contains it. Default is “No”.
delimiter A string used to delimit fields. For example, a new line “\n” should match the list separator configuration.
filters A list of patterns to remove from the value. This can be a single string or a list of patterns, separated by the pattern defined in the delimiter argument. Unless match_exact is yes, regex pattern is supported.

Outputs


There are no outputs for this script.

args:
- default: true
  description: The value on which the transformer is applied.
  isArray: true
  name: value
- auto: PREDEFINED
  defaultValue: "Yes"
  description: Whether to ignore the case of the item for which you are searching. Default is "Yes".
  name: ignore_case
  predefined:
  - "yes"
  - "no"
- auto: PREDEFINED
  defaultValue: "No"
  description: Whether to match the exact item in the list, or look for any string that contains it. Default is "No".
  name: match_exact
  predefined:
  - "yes"
  - "no"
- defaultValue: \n
  description: A string used to delimit fields. For example, a new line "\n" should match the list separator configuration.
  name: delimiter
- description: A list of patterns to remove from the value. This can be a single string or a list of patterns, separated by the pattern defined in the delimiter argument. Unless match_exact is yes, regex pattern is supported.
  required: true
  name: filters
comment: |-
  Removes items from the given list of values if they match any of the patterns in the provided `filters`.
  If the match_exact argument is 'yes', direct string compare is used, otherwise the comparison is done using regex.
commonfields:
  id: RemoveMatches
  version: -1
dockerimage: demisto/python3:3.12.13.10404775
enabled: true
engineinfo: {}
name: RemoveMatches
runas: DBotWeakRole
runonce: false
script: ''
scripttarget: 0
isllm: false
subtype: python3
tags:
- transformer
- entirelist
- general
type: python
fromversion: 6.10.0
tests:
- No tests (auto formatted)