Skip to content

Regex Search and Match

Searches an input string using a regular expression and returns all matches. It performs a global search across the entire text and outputs the results as a list. If the pattern contains capture groups, the output reflects those groups.
Preview

Usage

Use this node when you need to extract all occurrences that match a specific pattern from a block of text (e.g., emails, IDs, keywords of a certain length). Typically used before downstream parsing, validation, filtering, or branching logic that depends on detected tokens.

Inputs

FieldRequiredTypeDescriptionExample
text_inputTrueSTRINGThe text to search. Can be multi-line.Please contact alice@example.com or bob@example.org for details.
regex_patternTrueSTRINGRegular expression to match against the input text. Use standard regex syntax. Backslashes must be escaped in string literals.\b[a-zA-Z]{6}\b

Outputs

FieldTypeDescriptionExample
matchesLISTA list of all matches found. If the pattern has capture groups, each match may be a string (no groups) or a tuple/list (with groups). Returns an empty list if no matches are found.['alice', 'bobcat']

Important Notes

  • If the regex pattern contains capture groups, each item in the output may be a tuple of captured group values rather than a single string.
  • Invalid regex patterns will cause an error; verify your pattern syntax.
  • The search is global across the entire input and is not case-insensitive unless specified in the pattern (e.g., (?i)).
  • Remember to double-escape backslashes in patterns entered as strings (e.g., "\d+" for digits).
  • Performance can degrade with very large texts or complex patterns; optimize your regex when processing long documents.
  • By default, dot (.) does not match newlines unless you use modifiers like (?s).

Troubleshooting

  • Pattern returns an empty list: Confirm the text truly contains matches and that anchors/boundaries (e.g., \b, ^, $) are appropriate for your data.
  • Unexpected tuple outputs: Remove capture groups or convert them to non-capturing groups (?:...) if you want full-match strings.
  • Regex syntax error: Validate the pattern with a regex tester or simplify the expression to locate the error.
  • Missing matches due to case: Add (?i) to the pattern or explicitly include case ranges.
  • Multiline behavior issues: Use (?m) for ^/$ across lines or (?s) for dotall behavior if needed.

Example Pipelines

Example
Example