The REGEXREPLACE() function replaces all matches of a regular expression with new text, to clean, normalise or transform a text. It returns text.
The output format of the result is configured in the output field options of the formula editor: see Formula column.
Syntax
REGEXREPLACE(texte, expression_régulière, remplacement)
How to reference parameters in TimeTonic: $field_name for a field (link, linked-table column, number, selection, formula, text); "free text" in quotes; no quotes for numbers.
Parameters
Examples
Replace a word in a text
"Supermarché" becomes "Hypermarché".
REGEXREPLACE("Supermarché", "Super", "Hyper")
What the regex does:
- "Super" → pattern to find (here, plain text: it also works as a regex)
- "Hyper" → replacement text. Result → every occurrence found is replaced.
Clean a phone number (keep digits only)
"Tél : 06 12 34 56 78" becomes "0612345678".
REGEXREPLACE("Tél : 06 12 34 56 78", "[^0-9]")
What the regex does:
- [^0-9] → "anything that is not a digit"
- (empty replacement) → removes those characters
- Result → only 0612345678 remains
Works on text only. The remplacement parameter is optional: if it is omitted, the occurrences found are removed. If no match is found, the function returns an empty value. The \ character and some shortcuts (\d, \w, \s) are not supported.
Best practices: use REGEXREPLACE() when SUBSTITUTE() is no longer enough, or when several variants need to be handled.
Best practices: use REGEXREPLACE() when SUBSTITUTE() is no longer enough, or when several variants need to be handled.
See Introduction to REGEX() functions in TimeTonic for the complete usage rules.
Manipulating text with Regex
Go further
REGEXEXTRACT()
Extracts a specific piece of information from free text.
Or continue with
Formula glossary
All available operators and functions, sorted by category.