Use the regexMatch helper to search a string in your record (or other context field) using a regular expression. It returns the portion of the text that matches the specified pattern, optionally selecting which match occurrence (index) to return, and applying optional regex flags.
Note
See also Regular expressions (regex) .
{{regexMatch field regex index options}}
-
field: The field or variable name containing the text to search (e.g.,
record.details). -
regex: The regular expression pattern to match.
-
index (optional): Which match to return (0-based). Defaults to
0if omitted. -
options (optional): Regular expression flags like
"g","i", or"m".
-
Extracting numbers from a record field
Suppose
record.commentis"Order ID: 12345 delivered on 2025-04-20". You want to grab the first 5-digit number:{{regexMatch record.comment "[0-9]{5}"}}This returns
"12345". By default, this returns the first match (index 0). -
Using the index parameter
If
record.commenthas multiple matches, for example"IDs: 12345 and 67890", you can retrieve the second match (index 1) with:{{regexMatch record.comment "[0-9]{5}" 1}}This returns
"67890". -
Applying regex flags
Use the
optionsargument to include flags. For instance, to match case-insensitively:{{regexMatch record.comment "order id" 0 "i"}}If
record.commentis"ORDER ID: 98765", the helper will still match"ORDER ID"because of thei(case-insensitive) flag. -
Double vs. triple braces
{{{regexMatch record.comment "[0-9]+"}}}The triple braces (
{{{ }}}) return the raw matched string without Celigo’s automatic formatting (e.g., additional quotes).
Tip
-
If you only need a single match, leave
indexat its default (0). -
Add the
gflag (e.g.,"ig"for case-insensitive + global) only when you need to evaluate multiple matches; otherwise, the helper stops at the first match. -
Make sure your regular expression correctly captures the substring you want—particularly if you’re using capturing groups or special characters.
-
Use triple braces if you want to avoid any automatic formatting for the matched substring.