Replace
AI-generatedOverview
This node performs a regex-based search-and-replace operation on input text. It is useful for scenarios where you need to modify text by replacing parts of it that match a specific regular expression pattern with a replacement string. For example, it can be used to sanitize input data, update formatting, or remove unwanted characters from logs or scraped web content.
Use Case Examples
- Replacing all occurrences of a phone number pattern in a text with a placeholder.
- Updating date formats in a batch of text data by replacing matched patterns.
Properties
| Name | Meaning |
|---|---|
| Input Text | The text to process and apply the regex replacement on. |
| Regex Pattern | The regular expression pattern used to find matches in the input text. |
| Regex Flags | Flags for the regular expression, such as 'g' for global replacement, 'i' for case-insensitive matching, or 'm' for multiline mode. |
| Replacement | The text to replace each match of the regex pattern with. |
Output
JSON
result- The result of the regex replace operation, containing the modified text after replacements.
Dependencies
- An API key credential for a custom external regex processing service (customJsApi).
Troubleshooting
- Common issues include invalid regex patterns causing errors, which will be reported in the node's error output.
- If the API key credential is missing or invalid, the node will fail to authenticate and perform the operation.
- Ensure the regex flags are correctly set, especially the 'g' flag for global replacement, to replace all matches rather than just the first.
Links
- JavaScript Regular Expressions - Reference for regex patterns and flags used in the node.