Help Centre › Functions & Formulas
For a full list of available calculation functions, please read What calculation functions are supported.
This article describes the formula syntax and usage of the REGEXREPLACE function.
Description
Replaces substrings that match a regular expression with a specified replacement string.
Syntax
REGEXREPLACE(text, regular_expression, replacement)
The REGEXREPLACE function has the following arguments:
- text - Required. The text to search for matches.
- regular_expression - Required. The regular expression to match against text.
- replacement - Required. The string to replace each match with.
Remarks
- If there are no matches, REGEXREPLACE returns the original text.
- The regular expression must match the entire text string. If you want to replace only part of the text, use parentheses in the regular expression to capture the part you want to replace.
Example
| Formula | Description | Result |
| =REGEXREPLACE("abc123", "[0-9]+", "XYZ") | Replaces the first sequence of digits in "abc123" with "XYZ". | abcXYZ |
Errors
For a full list of formula errors, please read Formula errors.