The regexReplace helper replaces substrings that match a regular expression pattern with a specified replacement value. Use it to clean up field values, redact sensitive data, normalize formats, or transform strings before exporting them in a flow.
Syntax
{{regexReplace field replacement regex options}}
field -- The string or field to modify. Required.
replacement -- The value to substitute for each match. Required. Pass "" to delete matching substrings.
regex -- The regular expression pattern identifying the text to replace. Required. Use JavaScript-style regex syntax -- escape special characters as needed (e.g. \. for a literal dot, \\ for a backslash).
options -- Regex flags to apply. Optional. Use "g" to replace all matches rather than only the first.
Examples
Redact credit card numbers
{{regexReplace record.notes "#### #### #### ####" "[0-9]{4} ?[0-9]{4} ?[0-9]{4} ?[0-9]{4}" "g"}}
Input: record.notes is "Payment with 4111 1111 1111 1111 approved"
Output: Payment with #### #### #### #### approved
Remove spaces and dashes from a SKU
{{regexReplace record.item.sku "" "[ -]" "g"}}
Input: record.item.sku is "ABC-123 45"
Output: ABC12345
Passing "" as the replacement deletes all matching characters.
Convert CRLF line endings to LF
{{{regexReplace record.description "\n" "\r\n" "g"}}}
Use triple braces when the output needs to be embedded as raw text without Celigo's automatic formatting.
Usage notes
- Patterns follow JavaScript regular expression syntax. Escape special characters as needed:
\.for a literal dot,\\for a backslash. - Without the
"g"flag, only the first match is replaced. Use"g"to replace all occurrences. - Pass
""as the replacement to delete matching substrings. - Use triple braces (
{{{ }}}) when embedding the result in a manually built JSON body or other context that requires raw output. - For more on regex syntax and supported patterns, see Regular expressions (regex).