Text Replace Node
The Text Replace node belongs to the “Text Processing” category. It replaces every occurrence of a target string with new content inside your workflow text. Typical use cases include template rendering, placeholder cleanup, and post-processing of model outputs.
Node Configuration
Basic Settings
-
Node Name
- Assign a descriptive name such as “Replace Customer Salutation”
- The output variable uses this name as its prefix (for example,
$Replace Customer Salutation.text
)
-
Text Source
- Select the upstream variable that provides the text to process
- Supports context references like
$input.content
or$LLM.output
-
Search For
- Define the original string you want to locate and replace
- Accepts literal text only; context variables are not expanded
-
Replace With
- Provide the replacement string
- Accepts literal text only; leave it empty to remove the target text entirely
-
Output Variable
- Defaults to
text
- Refer to the processed result in downstream nodes with
$NodeName.text
- Defaults to
How It Works
- Only the “Text Source” field expands context variables at runtime. The engine resolves
$node.field
placeholders within the text, while “Search For” and “Replace With” are treated as literal values. - When the “Search For” field is empty, the node raises an error and stops execution to prevent accidental data loss.
- Escape the dollar sign with a backslash (for example,
\$variable
) if you need to keep the literal text.
Usage Example
The following example removes a fixed tag from an LLM response:
- Suppose the LLM node output contains a signature line such as:
[Disclaimer] This response is for reference only.
- Configure the Text Replace node:
Text: $LLM.outputSearch For: [Disclaimer]Replace With: (leave empty)
- Reference
$Text Replace.text
in a Content Combiner or Output node to display the cleaned response.
Advanced Use Cases
Clean Up Model Responses
Run a Text Replace node after an LLM to standardize typos, strip unwanted guidance phrases, or mask sensitive data with placeholders.
Pair with Loops or Branches
Combine with loop nodes to process each list item, or branch-specific replacements to deliver tailored messages for different segments.
Template Placeholder Handling
Use the node to swap fixed placeholders with predetermined wording after composing text in a Content Combiner or template node.
Best Practices
- Clear Naming: Use an “action + target” naming style such as “Replace SKU Code” for easier debugging.
- Validate Inputs: Confirm the target text actually appears in the source; a Content Combiner preview helps catch mistakes quickly.
- Step-by-Step Debugging: Split multiple replacements into separate Text Replace nodes so each output stays predictable.
- Keep It Idempotent: Avoid adding repeated suffixes or markers when the workflow may run more than once on the same content.