Overview
The regex node applies regular expressions to message string
values. Supports pattern matching, data extraction with capture groups, find-and-replace,
string splitting, and boolean testing. Powerful for parsing log files, validating input formats,
and transforming structured text data.
Properties
| Property | Type | Default | Description |
|---|---|---|---|
| pattern | string | "" | Regular expression pattern |
| operation | string | "match" | match, replace, extract, split, test |
| replacement | string | "" | Replacement string (replace mode) |
| property | string | "payload" | Message property to apply regex to |
| global | boolean | false | Match all occurrences (g flag) |
| ignoreCase | boolean | false | Case insensitive matching (i flag) |
| multiline | boolean | false | Multiline mode, ^ and $ match lines (m flag) |
Operation Modes
match / extract
Return matched strings or capture groups
match: returns full matches
extract: returns capture groups
Pattern: (\d+)\.(\d+)
Input: "temp=24.5"
Extract: ["24", "5"] replace
Find and replace pattern matches
Pattern: \s+
Replace: "_"
Input: "sensor raw data"
Output: "sensor_raw_data" split / test
Split string or boolean test
split: "a,b;c" → ["a","b","c"]
Pattern: [,;]
test: returns true/false
Pattern: ^\d+$
"123" → true
"abc" → false Example: Extract Numbers from Log Lines
Parse structured log output from serial devices to extract numeric readings.
// Regex node configuration
{
"pattern": "T=(\d+\.\d+)\sH=(\d+\.\d+)\sP=(\d+\.\d+)",
"operation": "extract",
"property": "payload",
"ignoreCase": false,
"multiline": false
}
// Input (serial log line):
// "2024-01-25 14:30:22 T=24.50 H=62.30 P=1013.25"
// Output (extracted capture groups):
{
"payload": ["24.50", "62.30", "1013.25"]
}
// Follow with a change node to structure:
{
"temperature": 24.50,
"humidity": 62.30,
"pressure": 1013.25
} Example: Validate Email Addresses
Test incoming form data for valid email format before processing.
// Regex node configuration
{
"pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$",
"operation": "test",
"property": "payload.email",
"ignoreCase": true
}
// Flow: http-in → regex (test) → switch → process / reject
// Input:
{ "payload": { "email": "user@example.com" } }
// Output: { "payload": true } → switch routes to process
// Input:
{ "payload": { "email": "not-an-email" } }
// Output: { "payload": false } → switch routes to reject Example: Clean and Transform Serial Data
Strip control characters and reformat raw serial input.
// Regex node: strip control characters
{
"pattern": "[\x00-\x1F\x7F]",
"operation": "replace",
"replacement": "",
"property": "payload",
"global": true
}
// Input: "\r\nSENSOR:OK:24.5:62\r\n"
// Output: "SENSOR:OK:24.5:62"
// Chain a split regex to tokenize:
{ "pattern": ":", "operation": "split" }
// Result: ["SENSOR", "OK", "24.5", "62"] Common Use Cases
Log Parsing
Extract structured data from unstructured log lines
Input Validation
Validate emails, IPs, MAC addresses, phone numbers
Serial Data Parsing
Parse delimited or fixed-format serial protocols
Text Sanitization
Strip HTML, control characters, or whitespace