Replace
Function: Replace
This function allows you to find specific parts of a text and replace them with different text. It's useful for standardizing information, correcting typos, or removing unwanted characters from a longer piece of text.
Input,
- Text (STRING, Required): The original text where you want to make replacements.
- Replace text (STRING, Required): The specific piece of text you want to find within the original text.
- Replace with (STRING, Optional): The new text that will replace every occurrence of the "Replace text". If left empty, the "Replace text" will be removed entirely.
Output,
- Result (STRING): The modified text after all replacements have been made. This output will be stored in a variable named "RESULT" by default, or in a variable with the name you specify.
Execution Flow,
Real-Life Examples,
Here are some examples of how you can use the "Replace" function:
Example 1: Correcting a common typo
Imagine you have a list of product descriptions, and you realize "colour" is consistently misspelled as "color" in your region.
- Inputs:
- Text: "The product is available in a beautiful blue color and a vibrant red color."
- Replace text: "color"
- Replace with: "colour"
- Result: The application will create a variable (e.g., named "RESULT") containing the text: "The product is available in a beautiful blue colour and a vibrant red colour."
Example 2: Removing unwanted characters from a phone number
You're processing customer data and need to standardize phone numbers by removing hyphens and spaces.
- Inputs:
- Text: "Customer Phone: +1 (555) 123-4567"
- Replace text: "-"
- Replace with: (leave empty)
- Result: The application will create a variable (e.g., named "RESULT") containing the text: "Customer Phone: +1 (555) 1234567". You could then run this action again to remove spaces and parentheses.
Example 3: Updating a product code prefix
Your company is rebranding, and all product codes need to change from "OLD-" to "NEW-".
- Inputs:
- Text: "Product codes: OLD-ABC-123, OLD-XYZ-456, OLD-MNO-789"
- Replace text: "OLD-"
- Replace with: "NEW-"
- Result: The application will create a variable (e.g., named "RESULT") containing the text: "Product codes: NEW-ABC-123, NEW-XYZ-456, NEW-MNO-789".