RegexReplace
Format patterns matched with regex. If the regex does not match any pattern, the original value is returned. Example 1: value: user=john regex: user=(.*) output_format: name=\1 -> output value: name=john Example 2: value: xxx=yyy regex: user=(.*) output_format: name=\1 -> output value: xxx=yyy.
python · Filters And Transformers
Details
| ID | RegexReplace |
|---|---|
| Language | python |
| From Version | 6.5.0 |
| Docker Image | demisto/python3:3.12.13.10404775 |
| Tags | transformer string |
README
Format patterns matched with regex. If the regex does not match any pattern, the original value is returned.
Example 1:
value: user=john
regex: user=(.*)
output_format: name=\1
-> output value: name=john
Example 2:
value: xxx=yyy
regex: user=(.*)
output_format: name=\1
-> output value: xxx=yyy
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Tags | transformer, string |
| Cortex XSOAR Version | 5.0.0 |
Inputs
| Argument Name | Description |
|---|---|
| value | Text to match against |
| regex | Regex pattern to search |
| output_format | Template string to format patterns matched with regex |
| ignore_case | Whether character matching will be case-insensitive. Default is “false”. |
| multi_line | Process value in multiline mode. See more information on re.MULTILINE, see https://docs.python.org/3/library/re.html. |
| period_matches_newline | Whether to make the ‘.’ character also match a new line. Default is “false”. |
| action_dt | The last action for each matched value to transform |
Outputs
There are no outputs for this script.
args: - description: Text to match against. name: value required: true - description: Regex pattern to search. name: regex required: true - description: Template string to format patterns matched with regex. name: output_format - auto: PREDEFINED defaultValue: 'false' description: Whether character matching will be case-insensitive. Default is "false". name: ignore_case predefined: - 'true' - 'false' - name: multi_line auto: PREDEFINED predefined: - 'true' - 'false' description: Process value in multiline mode. See more information on re.MULTILINE, see https://docs.python.org/3/library/re.html. defaultValue: 'false' - name: period_matches_newline auto: PREDEFINED predefined: - 'true' - 'false' description: Whether to make the '.' character also match a new line. Default is "false". defaultValue: 'false' - name: action_dt description: The last action for each matched value to transform. comment: |- Format patterns matched with regex. If the regex does not match any pattern, the original value is returned. Example 1: value: user=john regex: user=(.*) output_format: name=\1 -> output value: name=john Example 2: value: xxx=yyy regex: user=(.*) output_format: name=\1 -> output value: xxx=yyy. commonfields: id: RegexReplace version: -1 dockerimage: demisto/python3:3.12.13.10404775 enabled: true name: RegexReplace runas: DBotWeakRole script: '' scripttarget: 0 isllm: false subtype: python3 tags: - transformer - string type: python fromversion: 6.5.0 tests: - No tests (auto formatted) contentitemexportablefields: contentitemfields: fromServerVersion: ''