Replace component
The Replace component allows you to use regular expressions (regex) to find and replace text within a message body.
Configuration
The Replace component has the following configuration options:
Regex
Specify a regular expression to match the text that needs to be replaced.
Multiline (flag)
Specify whether to find and replace text across multiple lines.
Ignore case
Specify whether to find and replace text while ignoring case sensitivity.
Dotall (SingleLine)
Specify whether a dot (.
) should match all characters, including newlines and other special characters.
Replace with
Specify the text that will replace the matched content.
- The characters
\n
(line feed),\r
(carriage return) and\t
(tab) will be unescaped, allowing them to be included in the replaced text. For example, you can to replace semi-colons (;
) withtabs
or insert anew line
whenever theRegex
matches. - To escape a space, prepend a slash:
\
. - Leave this field empty to remove the matched text.
Group
Specify which group you want to use to find and replace text in, if the regular expression has one or more groups you can select.
Only available after specifying a regex and clicking the 'Retrieve Groups & Verify Regex' button.
More information about groups in regular expressions can be found here
Retrieve Groups & Verify Regex
After specifying a regex, click the 'Retrieve Groups & Verify Regex' button to verify the regular expression and retrieve the regex groups.
If the regex contains multiple groups, you can select a specific Group for replacement or leave it at All
to apply the replacement to all matches.
Using Replace
Specify a regular expression and its replacement value.
A great resource to create and evaluate regex is Regex 101.
In the left column of Regex 101:
- Set Flavour to
Java 8
when creating regex for Dovetail. - Set Function to
Substitution
to preview the effect of replacements.