Replace Text
Replace a text with another text.
Overview
This operation lets you replace occurrences of a specific text with a new text. For instance, consider the following sentence:
The dog jumped over the curb and then the dog sprinted away.
Using this operation, you can replace all instances of dog with cat, resulting in:
The cat jumped over the curb and then the cat sprinted away.
Syntax
This operation supports both of the following syntaxes:
Option 1
the text is "{input}"
replace "{substring}" with "{replacement}" in the text
the replacement strategy is "{strategy}"
Option 2
the text is "{input}"
replace "{substring}" in the text where
the replacement is "{replacement}"
the replacement strategy is "{strategy}"
Note: Specifying the replacement strategy is optional. By default, all occurrences are replaced.
Data
The table below lists the names of the data elements in this operation and indicates which can be renamed in the syntax.
Data Name | Can Be Renamed |
---|---|
the text | Yes |
the replacement strategy | No |
Parameters
Parameters are placeholders for data. Refer to the table below for details on each parameter in this operation. In the syntax, replace parameters with your own values.
Parameters | Description | Examples | Required |
---|---|---|---|
| The input text where replacements will occur. | The dog jumped over the curb and then the dog sprinted away. | Yes |
| The section of the text to be replaced. | dog | Yes |
| The replacement value. | cat | Yes |
| The method for replacing matches of the substring. Accepted values:
| all | Optional |
Examples
1. Replace all occurrences
the text is "The dog jumped over the curb and then the dog sprinted away."
replace "dog" with "cat" in the text
The cat jumped over the curb and then the cat sprinted away.
2. Replace the first occurrence
the text is "The dog jumped over the curb and then the dog sprinted away."
replace "dog" with "cat" in the text
the replacement strategy is "first"
The cat jumped over the curb and then the dog sprinted away.
Updated 30 days ago