Replaces only the first occurrence of a specified substring in a string with another value. Use it when you want to substitute the first match but leave later matches unchanged.
-
Replace the first occurrence of a character
{{replacefirst record.text "a" "z"}}Input:
{ "record": { "text": "a b a b a b" } }Output:
z b a b a b -
Replace only the first word
{{replacefirst record.note "Order" "Invoice"}}Input:
{ "record": { "note": "Order Order Order" } }Output:
Invoice Order Order
Tip
-
Only the first matching substring is replaced; later matches remain unchanged.
-
Matching is case-sensitive—
"A"and"a"are treated differently. -
Use this helper when you need to replace a predictable prefix, tag, or marker without altering the rest of the string.