Regex icon

Regex

Regex Node

Replace

AI-generated

Overview

This node performs a regex-based replacement operation on input string data. It is useful for scenarios where you need to modify text by replacing parts of it that match a specific regular expression pattern. For example, it can be used to sanitize input data, reformat strings, or remove unwanted characters based on regex patterns.

Use Case Examples

  1. Replacing all occurrences of digits in a string with a placeholder.
  2. Removing or replacing specific words or patterns in text data.

Properties

Name Meaning
Data The input string on which the regex operation will be performed.
Regex Pattern The regular expression pattern used to find matches in the input data.
Flags Flags to modify the behavior of the regex, such as 'i' for case-insensitive and 'g' for global matching.
Replacement The string to replace each match of the regex pattern with.

Output

JSON

  • data - The resulting string after performing the regex replacement operation.

Troubleshooting

  • Ensure the regex pattern is valid to avoid runtime errors.
  • If the replacement does not work as expected, verify the flags and regex pattern correctness.
  • Errors during execution will be output as an error message in the JSON output with an 'error' property.

Discussion