Regex Search and Replace¶
Finds all matches of a regular expression in the input text and replaces them with the provided replacement text. Uses standard regular expression behavior, supporting boundaries, character classes, groups, and backreferences in the replacement. Designed for straightforward, single-pass replacements over an entire string.

Usage¶
Use this node when you need to normalize, redact, or transform text based on patterns (e.g., replace all 5-letter words, mask emails, reformat dates). Place it after any node that produces text and before downstream nodes that consume the transformed result.
Inputs¶
| Field | Required | Type | Description | Example |
|---|---|---|---|---|
| text_input | True | STRING | The source text in which the regex will search for matches to replace. | Contact me at john.doe@example.com or jane@example.org. |
| regex_pattern | True | STRING | Regular expression pattern to match. Follows Python-style regex syntax, including groups and anchors. | \b\w{5}\b |
| replacement_text | True | STRING | Text used to replace each match. Can include backreferences like \1 for captured groups. | [REDACTED] |
Outputs¶
| Field | Type | Description | Example |
|---|---|---|---|
| replaced_text | STRING | The resulting text after all matches of the pattern have been replaced. | Contact me at [REDACTED] or [REDACTED]. |
Important Notes¶
- Regex flavor: Uses Python-style regular expressions (e.g., groups ( ), non-greedy quantifiers ?, word boundaries \b).
- Escaping: When entering patterns in a string field, backslashes must be escaped (e.g., use \b for a word boundary).
- Flags: There is no separate flags input; use inline flags in the pattern if needed (e.g., (?i) for case-insensitive, (?s) to make . match newlines).
- Backreferences: Use numeric backreferences like \1, \2 in the replacement_text to reuse captured groups.
- Greediness: Patterns are greedy by default; use ? for non-greedy matches where appropriate.
- No match behavior: If the pattern matches nothing, the output is identical to the input.
Troubleshooting¶
- Invalid regex pattern: If processing fails, verify the pattern compiles; check for missing escapes or unbalanced parentheses.
- Unexpected replacements: Add anchors (\b, ^, $), make quantifiers non-greedy (?), or refine character classes to limit matches.
- Case sensitivity issues: Add inline flag (?i) to the pattern for case-insensitive matches.
- Multiline text not matching: Use inline flags like (?m) for multiline anchors or (?s) to let . match newlines, or use character classes like [\s\S].
- Backreference not working: Ensure you used double backslashes (e.g., \1) and that the corresponding group exists in the pattern.
- Nothing changed: Confirm the pattern actually matches the input text; test with a simpler pattern to validate the pipeline.
Example Pipelines¶