StringReplace
Replaces regex match/es in string. Returns the string after replace was preformed.
javascript · Common Scripts
Details
| ID | StringReplace |
|---|---|
| Language | javascript |
| From Version | 5.0.0 |
| Tags | Utility |
README
Replaces regex match/es that are found in the string.
This script will return the string after the replacement was performed.
Script Data
| Name | Description |
|---|---|
| Script Type | javascript |
| Tags | Utility |
Inputs
| Argument Name | Description |
|---|---|
| data | The string to perform the replacement on. |
| regex | The regex used to find matches that will be replaced with a new value. |
| newValue | The new value to replace the regex match. Pass ‘’ to remove regex match. |
| replaceAll | Whether to replace matches. Pass true to replace all matches, false to replace only the first occurrence. |
| caseInsensitive | Whether to perform a case-insensitive search and replace. Pass true to perform case-insensitive search and replace, false for case-sensitive. |
| multiLine | Pass true to indicate ‘data’ is a multi-line string, false otherwise. |
Outputs
| Path | Description | Type |
|---|---|---|
| StringReplace.Result | The string after the replacement was performed. | Unknown |
commonfields: id: StringReplace version: -1 name: StringReplace script: '' type: javascript tags: - Utility comment: |- Replaces regex match/es in string. Returns the string after replace was preformed. enabled: true args: - name: data required: true default: true description: The string to preform replace on - name: regex required: true description: The regex to find matches to be replaced with a new value - name: newValue required: true description: The new value to replace the regex match. Pass '' to remove regex match. - name: replaceAll auto: PREDEFINED predefined: - "true" - "false" description: Pass true to replace all matches, false to replace only the first occurrence. defaultValue: "true" - name: caseInsensitive auto: PREDEFINED predefined: - "true" - "false" description: Pass True to preform case-insensitive search and replace, false for case-sensitive. defaultValue: "true" - name: multiLine auto: PREDEFINED predefined: - "true" - "false" description: Pass true to indicate 'data' is a multi-line string, false otherwise. defaultValue: "true" outputs: - contextPath: StringReplace.Result description: The string after replace was preformed scripttarget: 0 fromversion: 5.0.0