Regex Operation
regexPerform regular expression matches (Contains) or text substitutions (Find and Replace) directly on workflow context.
About this Node
Applies a deterministic regular expression operation (`replace`, `contains`, `extract_first`, `extract_all`, or `split`) to a string read from workflow state at `input_key` and stores the result under `output_key`. Ideal for parsing IDs, scrubbing PII, normalizing strings, or splitting text into arrays for Parallel Fan-out.
Ports & Branches
inPort 0Inbound execution flowoutPort 1Outbound execution flow with regex outputHow this Node Reads Data
| Input | Access | Field | Example | Description |
|---|---|---|---|---|
| Source State Key | State Key | input_key |
raw_email_body |
Reads the string value stored under `input_key` in the node's incoming state. |
State Keys Written (Outputs)
| Key Pattern | Type | Role | Description |
|---|---|---|---|
{output_key} |
string | boolean | array<string> |
Primary | Substituted string (`replace`), boolean check (`contains`), first match/groups (`extract_first`), all matches (`extract_all`), or array of parts (`split`). |
Tips & Best Practices
- Alias `regex` resolves to `logic_regex` in authoring specs and `/docs?node=regex`.
- Runs deterministically in-process with zero container spin-up overhead—prefer Regex over Python Script for simple string extraction.
Commonly Paired With
Settings Parameters (5)
Configuration schema synchronized with the workflow catalog
| Field | Type | Default | Allowed Options | Description |
|---|---|---|---|---|
operation |
string |
replace |
replace, contains, extract_first, extract_all, split | The type of regex operation to perform (replace, contains, extract_first, extract_all, or split) |
input_key |
string |
prompt |
— | State key containing the input text to search/replace |
pattern |
string |
\b[a-zA-Z]+\b |
— | Regular expression pattern |
replacement |
string |
"" |
— | Replacement text (used in 'replace' operation) |
output_key |
string |
regex_result |
— | State key to write the result to |
Extract Invoice Number from Email Text
Pull the first `INV-12345` token out of an unstructured message and store it in `invoice_id`.
Node Configuration
{
"Id": "logic_regex_1",
"Type": "logic_regex",
"Config": {
"operation": "extract_first",
"input_key": "email_body",
"pattern": "INV-[0-9]{4,8}",
"output_key": "invoice_id"
}
}Sample Input State
{
"email_body": "Please pay INV-20491 by Friday."
}Expected Output State
{
"invoice_id": "INV-20491"
}Redact Credit Card Numbers Before Logging
Replace 16-digit card patterns with `[REDACTED]` prior to calling an LLM or external webhook.
Node Configuration
{
"Id": "logic_regex_1",
"Type": "logic_regex",
"Config": {
"operation": "replace",
"input_key": "customer_note",
"pattern": "\\b(?:\\d[ -]*?){13,16}\\b",
"replacement": "[REDACTED]",
"output_key": "sanitized_note"
}
}Sample Input State
{
"customer_note": "Card 4111-1111-1111-1234 declined"
}Expected Output State
{
"sanitized_note": "Card [REDACTED] declined"
}Tip: Use `split` mode to turn newline- or comma-delimited text into an array ready for Parallel Fan-out (`logic_parallel`).