Regex Search and Replace¶
Performs a regular-expression-based search and replace on the provided text. It replaces all occurrences that match the given regex pattern with the specified replacement text. Supports multiline input and backreferences in the replacement.

Usage¶
Use this node when you need to systematically modify text using patterns—such as masking sensitive data, normalizing formats, or transforming structured strings. Place it in workflows that clean, preprocess, or reformat text before downstream processing or storage.
Inputs¶
| Field | Required | Type | Description | Example | 
|---|---|---|---|---|
| text_input | True | STRING | The source text where regex matches will be searched and replaced. | The quick brown fox jumps over 123 lazy dogs. | 
| regex_pattern | True | STRING | A Python-compatible regular expression pattern used to find text to replace. | \b\w{5}\b | 
| replacement_text | True | STRING | Text to substitute for each match found by the regex. Supports backreferences like \1, \2 for captured groups. | [REDACTED] | 
Outputs¶
| Field | Type | Description | Example | 
|---|---|---|---|
| replaced_text | STRING | The resulting text after applying the regex-based replacements to the input. | The [REDACTED] brown [REDACTED] jumps over 123 lazy dogs. | 
Important Notes¶
- Regex engine: Uses Python regular expressions. Ensure your pattern is valid for Python’s regex syntax.
- Global replacement: All matches in the text are replaced (no limit parameter).
- Backreferences: You can reference captured groups in the replacement text (e.g., \1).
- Flags: There is no separate flags input. Use inline flags in the pattern if needed (e.g., (?i) for case-insensitive).
- Escaping: When entering patterns with backslashes, ensure proper escaping in the UI (e.g., \b for a word boundary).
Troubleshooting¶
- Invalid regex pattern (re.error): If the node errors, verify the pattern is valid and properly escaped.
- No changes in output: Confirm the pattern actually matches the input. Test with simpler patterns or use a match node to verify.
- Unexpected replacements: Anchor your pattern (e.g., \b, ^, $) or make it more specific to avoid over-matching.
- Backreference not working: Ensure you used capturing groups in the pattern, and reference them correctly in the replacement (e.g., (pattern) with \1).
- Multiline behavior: If matches don’t cross lines as expected, add inline flags like (?s) for DOTALL or (?m) for multiline.
Example Pipelines¶
