This operation allows you to search for specific patterns within your input data and replace them with new text.
Data types
These are the input/output expected data types for this operation:
Input data
- Text or data where you want to perform find-and-replace operations.
Output data
- Output strings after the find-and-replace operations.
Parameters
These are the parameters you need to configure to use this operation (mandatory parameters are marked with a *):
Substring to find*
Enter the text or pattern you want to find in the input.
Replacement*
Enter the text with which you want to replace each match. You can use RegEx patterns here.
Global Match*
Set true if you want to replace all matches found. If this is set to false, only the first match will be replaced. The default value is true.
Case Insensitive*
Set true if you want to ignore case when matching. The default value is false.
Multiline*
Set true to enable multiline mode. This feature controls how to treat line breaks in the input. Specifically, it affects the behavior of the ^ and $ anchors in the RegEx patterns you use in the Substring to find parameter.
When Multiline is enabled:
^ matches the start of a line, not just the start of the whole input.
$ matches the end of a line, not just the end of the whole input.
This means the regex treats the input as multiple lines, and you can match patterns at the beginning/end of each line.
When Multiline is disabled:
^ and $ only match the start and end of the entire input, respectively.
This is useful for matching patterns that span across the whole input or aren't line-sensitive.
The default value is false.
Example
Example with Multidataactivated:
Input data:
Info: All systems operational
Error: Disk space low
Warning: CPU usage high
Error: Memory leak detected
Substring to find - ^Error:.*
Replacement - ALERT
Multiline -true
Output data:
Info: All systems operational
ALERT
Warning: CPU usage high
ALERT
Example with Multidatadeactivated:
Input data:
Info: All systems operational
Error: Disk space low
Warning: CPU usage high
Error: Memory leak detected
Substring to find - ^Error:.*
Replacement - ALERT
Multiline -false
Output data:
Info: All systems operational
Error: Disk space low
Warning: CPU usage high
Error: Memory leak detected
Because ^ only applies to the start of the whole input with multiline off, the pattern never matches.
Dot Matches All*
Set true to match new line characters. Specifically, this affects how the . (dot) behaves in the RegEx patterns you use in the Substring to find parameter.
When Dot Matches All is enabled, the dot (.) also matches newline characters, allowing patterns to match across multiple lines.
The default value is false.
Example
Example with Dot Matches Allactivated:
Input data:
<start>
line 1
line 2
<end>
Substring to find - <start>.*<end>
Replacement - [BLOCK]
Dot Matches All -true
Output data:
[BLOCK]
.*includes newlines, so everything from <start> to <end> is matched and replaced.
Example with Dot Matches Alldeactivated:
Input data:
<start>
line 1
line 2
<end>
Substring to find - <start>.*<end>
Replacement - [BLOCK]
Dot Matches All -false
Output data:
<start>
line 1
line 2
<end>
.* does not match across newlines, so no match occurs.
Examples
Suppose you want to replace all the occurrences of the word "error" with "issue". To do it:
In the Operation field, choose Find and replace.
Set Substring to find to error.
Set Replacement to issue.
Set Global Match to true.
Set Case Insensitive to true.
Set Multiline to false.
Set Dot Matches All to false.
Give your Output field a name and click Save. The count will be displayed in the output field.
You can try out operations with specific values using the Input field above the operation. You can enter the value in the example above and check the result in the Output field.
In this example, given the following string:
The server encountered an error while processing your request.
you'll get this output:
The server encountered an issue while processing your request.
In your Pipeline, open the required configuration and select the input Field.