REPLACE_FIRST

Description

Returns a new string in which only the first occurrence matching the provided regular expression (regex) within the original string is replaced by the specified replacement substring.

Syntax

REPLACE_FIRST(string, regex, replacement) -> String

Parameters

ParameterData TypeRequiredDescription
stringStringYesThe original string.
regexStringYesThe regular expression defining the pattern to replace.
replacementStringYesThe substring used to replace the first matched pattern.

Example

REPLACE_FIRST("Order 1234: Total 56", "[0-9]+", "#")
-- Returns "Order #: Total 56".