Articles in this section

regexReplace helper

Replace part of a string in your flow data with a new value, using a regular-expression pattern to identify what should change.

Note

See also Regular expressions (regex) .

Usage

{{regexReplace field replacement regex}}
  • field – The text field or variable to modify (e.g., record.order.notes).

  • replacement – The value that should replace every substring matching regex.

  • regex – Regular-expression pattern that identifies the text to replace.

Examples

  1. Redacting credit-card digits in free-form notes

    {{regexReplace record.notes "#### #### #### ####" "[0-9]{4} ?[0-9]{4} ?[0-9]{4} ?[0-9]{4}" "g"}}
    

    If record.notes is

    "Payment with 4111 1111 1111 1111 approved"Payment with #### #### #### #### approved

  2. Normalizing SKU format (remove spaces & dashes)

    {{regexReplace record.item.sku "" "[ -]" "g"}}
    

    "ABC-123 45"ABC12345

  3. Converting CRLF line-endings to LF and returning raw output

    {{{regexReplace record.description "\n" "\r\n" "g"}}}
    

    Triple braces give the cleaned text exactly as produced, without Celigo’s automatic quoting or encoding.

Tip

  • Patterns are JavaScript-style regular expressions—escape special characters (\. for a literal dot, \\ for a backslash, etc.).

  • If the field might be empty or missing, combine this helper with a conditional or default to avoid null results.

  • Use triple braces ({{{ }}}) when you must embed the modified text without Celigo’s automatic formatting (e.g., inside a JSON body that you are building manually).Use the regexReplace helper to search a string for a specified pattern and replace matches with a chosen value. This is useful for cleaning up data, removing unwanted characters, or transforming fields into a new format before exporting them.