Skip to content

Regex Search and Match

Searches an input string using a regular expression and returns all matches as a list. It supports multiline text input and standard regular expression syntax. Results reflect Python-style regex behavior, including how capture groups affect output.
Preview

Usage

Use this node to extract patterns from text, such as emails, IDs, words of a certain length, or any custom pattern. Typically placed after a node that provides text content and before downstream nodes that iterate over or analyze the extracted matches.

Inputs

FieldRequiredTypeDescriptionExample
text_inputTrueSTRINGThe text to search for matches. Supports multiline input.Please contact us at support@example.com or sales@example.org.
regex_patternTrueSTRINGRegular expression pattern to find matches. Uses Python regex syntax. You can use inline flags like (?i) for case-insensitive matches.\b[a-zA-Z]{6}\b

Outputs

FieldTypeDescriptionExample
matchesLISTList of all matches found in the input text. If the pattern contains capture groups, each match may be a string (no groups) or a tuple (one or more groups). Returns an empty list if no matches are found.['support', 'sales']

Important Notes

  • Regex behavior: Matches are computed with Python's re.findall. If your pattern contains capture groups, the output elements may be tuples rather than plain strings.
  • No explicit flags input: Inline flags like (?i), (?m), (?s) can be embedded in the pattern to control case sensitivity, multiline, and dotall behavior.
  • Escaping: Remember to escape backslashes in patterns (e.g., use "\b" for a word boundary).
  • Empty results: If no matches are found, the node outputs an empty list.
  • Invalid patterns: A malformed regex pattern will cause an error; validate your pattern before running.

Troubleshooting

  • Unexpected empty list: Verify the pattern matches your text and consider case sensitivity. Add inline flags like (?i) if needed.
  • Matches are tuples instead of strings: Your pattern contains capture groups. Use non-capturing groups (?:...) or adjust downstream logic.
  • Regex compilation error: The pattern is invalid. Test and correct the pattern (e.g., unbalanced brackets or parentheses).
  • Greedy vs. non-greedy matches: If matches are larger than expected, use non-greedy quantifiers like *? or +?.
  • Escaping issues: Double-escape backslashes in the pattern string (e.g., "\d+" for digits).

Example Pipelines

Example
Example