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
| Parameter | Data Type | Required | Description |
|---|---|---|---|
| string | String | Yes | The original string. |
| regex | String | Yes | The regular expression defining the pattern to replace. |
| replacement | String | Yes | The substring used to replace the first matched pattern. |
Example
REPLACE_FIRST("Order 1234: Total 56", "[0-9]+", "#")
-- Returns "Order #: Total 56".