Skip to main content
The Regex command (Command Type: 1009) applies regex operations on strings or arrays within a data source. It supports the standard JavaScript regex methods: match, matchAll, search, replace, and replaceAll.

Overview

The Regex command provides functionality for:
  • Matching patterns in string fields
  • Replacing substrings using regex patterns
  • Searching for pattern occurrences
  • Applying flags like g, i, m, u, s for fine-grained control

Command Type

Command Type ID: 1009

Parameters

ParameterTypeDescriptionRequired
methodNamestringThe regex method to apply. Possible values: "match", "matchAll", "search", "replace", "replaceAll"Yes
patternstringThe regex pattern to applyYes
flagstringOptional regex flags (e.g. g, i, m, u, s)No
replaceValuestringThe replacement value for replace or replaceAll methodsNo
sourcestringThe key in the data source to apply the regex on. If not provided, operates directly on the dataNo

Usage Examples

Match a Pattern

{
  "command": "regex",
  "params": {
    "methodName": "match",
    "pattern": "\\d+",
    "source": "rawText"
  }
}

Replace a Substring

{
  "command": "regex",
  "params": {
    "methodName": "replace",
    "pattern": "\\s+",
    "replaceValue": "_",
    "source": "name"
  }
}

Replace All Occurrences

{
  "command": "regex",
  "params": {
    "methodName": "replaceAll",
    "pattern": ",",
    "replaceValue": ".",
    "source": "priceString"
  }
}

Case-Insensitive Match

{
  "command": "regex",
  "params": {
    "methodName": "match",
    "pattern": "error",
    "flag": "i",
    "source": "message"
  }
}

Supported Methods

MethodDescription
matchReturns the first match of the pattern
matchAllReturns all matches of the pattern
searchReturns the index of the first match
replaceReplaces the first match with replaceValue
replaceAllReplaces all matches with replaceValue

Common Use Cases

  • Data Cleaning: Remove or replace unwanted characters from string fields
  • Pattern Extraction: Extract numeric IDs, codes, or tokens from raw text
  • Normalization: Standardize formats (e.g. date strings, phone numbers)