Articles in this section

regexSearch helper

Locate the position (0-based index) of the first substring that matches a regular-expression pattern within a string.

Note

See also Regular expressions (regex) .

Usage

{{regexSearch field regex [options]}}
  • field – Text field or variable to search (e.g., record.total).

  • regex – Regular-expression pattern.

  • options(optional) – Regex flags such as "i" (case-insensitive) or "m" (multiline).

The helper returns the numeric index of the match, or -1 when the pattern is not found.

Examples

  1. Locating a character in a price

    {{regexSearch record.total "5"}}
    

    If record.total is "$1499.95", the helper returns 7 (the “5” is the eighth character).

  2. Finding the decimal point

    {{regexSearch record.total "\."}}
    

    Returns 5 for "$1499.95"—the "." is at index 5.

  3. Case-insensitive search in notes

    {{regexSearch record.comment "celigo" "i"}}
    

    With record.comment = "HELLO Celigo", the helper returns the index of "Celigo" even though the case differs.

Tip

  • The index is zero-based (0, 1, 2, …).

  • If no match is found, expect -1 and handle that outcome in subsequent mappings.

  • Triple braces ({{{ }}}) are usually unnecessary here—the helper returns a plain number that is not subject to Celigo’s automatic string formatting.