Regex Tools

Match, extract, and replace text using regular expressions.

Overview

The Regex Tools connector is a built-in utility for pattern matching against strings inside a workflow. It exposes the standard regex operations - test, match, extract, replace, split, count - plus helpers for validating a pattern and escaping user input so it can be embedded safely in another expression.

It's the right tool when an upstream connector hands you semi-structured text (an email body, a webhook payload, an extracted PDF) and you need a specific substring or a deterministic transform. For free-form natural language, prefer an AI Transform node; for everything formulaic - order IDs, SKUs, tracking numbers, dates inside log lines - regex is faster, cheaper, and reproducible.

What You Can Do

The Regex connector exposes these tools:

  • test - Return true/false for whether a pattern matches a string.
  • match - Return the first match of a pattern with its capture groups.
  • extract - Return all matches of a pattern from a string.
  • positions - Return start/end indices for each match.
  • replace - Substitute all matches of a pattern with a replacement string.
  • split - Split a string into an array on regex matches.
  • count - Count how many times a pattern occurs in a string.
  • validate - Check that a regex pattern compiles.
  • escape - Escape a literal string for safe inclusion in another regex.

Authentication and Setup

No connection or authentication is required. These tools are built into the platform and available in every workflow by default - just drop a Connector node onto the canvas and pick the tool you need.

Using in a Workflow

Add a Connector node, select Regex Tools, and pick a mode:

  • Direct Mode - Strongly recommended. Pin the exact pattern in the node config so it's reviewable; that's the whole point of using regex over AI extraction.
  • Agent Mode - Use only when the pattern itself needs to vary; otherwise the agent overhead defeats the speed advantage.

For validation use cases (is this string a valid SKU format?), prefer the Validation Tools connector when one of its named validators already covers your case.

Tips

  • Use named capture groups when extracting multiple fields - the result is self-describing instead of a positional array.
  • Anchor your patterns with ^ and $ when validating whole strings. Unanchored patterns happily match a substring inside garbage input.
  • Test on real data with test in a one-off run before wiring it into a production workflow.
  • Use escape when building a regex from user input or another field - otherwise dots, parentheses, and brackets in the data will be interpreted as syntax.

Common Pitfalls

  • Greedy quantifiers - .* matches as much as it can. Use .*? for non-greedy when extracting from text with multiple candidate matches.
  • Newlines - . does not match newlines by default. Use the appropriate flag (dotall) or be explicit with [\s\S].
  • Capture groups in replace - Reference groups with $1, $2, not \1, \2.
  • Catastrophic backtracking - Nested quantifiers on overlapping alternatives can run for seconds on a few-kilobyte string. Keep patterns simple.
  • Regex is the wrong tool for parsing nested structures - Use JSON Tools for JSON, XML Tools for XML, and an HTML parser for HTML.

Common Use Cases

Related Articles

For technical API details and field specifications, see the Regex Tools documentation.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.