Skip to main content

Replace text

Sophie avatar
Written by Sophie
Updated over a week ago

Definition and Usage

Replaces all occurrences of a specified text with another text. It can also be used with regular expressions to create more flexible search patterns.


Parameter Values

Input parameters

Parameter

Description

Possible Values

Required

Options / Notes

Original text

Enter text or select a variable containing the text

-

Yes

-

Replace method

Specify whether the subtexts are regular expressions

Text, Regular expression

Yes

Regular expressions create a range of possibilities for the subtext; e.g., '\d' means any digit

Text to find

Specify the text to search for

-

Yes

Only visible when "Text" method is selected

Regular expression

Regular expression

-

Yes

Only visible when "Regular expression" method is selected

Replace the first matched text only

Specify whether to replace the first matched text only

-

No

When checked, only replaces the first occurrence

Ignore case

Specify whether the replacement method is case-insensitive

-

No

When checked, matching ignores letter case

Replace with

The text to replace the found text

-

Yes

-

Error handling

Parameter Name

Description

Throw error & stop

When an error occurs, the action will trigger an error and stop the execution of the entire app.

Retry command

If an error occurs, the action will retry the command in an attempt to resolve the issue and continue the process.

Ignore error & continue

When an error occurs, the action will be ignored, and the workflow will continue without interruption.

Variables produced

This action produces a variable that contains the text after all replacements have been made.


Using Variables in Conditions

You can use variables in any parameter field where you see the {x} icon. This allows you to dynamically set the text to search for, the replacement text, or the original text using variables from previous steps in your workflow.


Notes

  • When using regular expressions, make sure to follow proper regex syntax to avoid unexpected results.

  • The "Replace the first matched text only" option is useful when you only want to change the first occurrence of a pattern.

  • If no matches are found, the original text will be returned unchanged.

  • Regular expressions provide powerful pattern matching capabilities; common patterns include:

    • \d - matches any digit

    • \w - matches any word character

    • \s - matches any whitespace character

    • .* - matches any sequence of characters

Did this answer your question?