The REGEXEXTRACT() function extracts a specific piece of information from free text, using a regular expression. It returns text (or several columns when groups are used).
The output format of the result is configured in the output field options of the formula editor: see Formula column.
Syntax
REGEXEXTRACT(texte, expression_régulière)
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
Extract an order number from a customer message
"Bonjour, ma commande n°24158 n'a toujours pas été livrée." becomes "24158".
REGEXEXTRACT("Bonjour, ma commande n°24158 n’a toujours pas été livrée.",
"[0-9]+")
What the regex does:
- [0-9]+ → extracts a sequence of consecutive digits.
- The function returns the first match found.
Extract an email address from free text
"Vous pouvez me répondre à l'adresse suivante : voici@monemail.com. Merci." becomes "voici@monemail.com".
REGEXEXTRACT("Vous pouvez me répondre à l’adresse suivante : voici@monemail.com. Merci.",
"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+[.][A-Za-z]{2,}")
What the regex does:
- [A-Za-z0-9._%+-]+ → email username
- @ → mandatory separator
- [A-Za-z0-9.-]+ → domain name
- [.][A-Za-z]{2,} → extension (.com, .fr, etc.)
Works on text only. 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 REGEXEXTRACT() when LEFT() / RIGHT() are no longer enough, when the position of the data varies, when the text is long or heterogeneous, when several values coexist in the same string, or when you work with user messages, imports or APIs.
Best practices: use REGEXEXTRACT() when LEFT() / RIGHT() are no longer enough, when the position of the data varies, when the text is long or heterogeneous, when several values coexist in the same string, or when you work with user messages, imports or APIs.
See Introduction to REGEX() functions in TimeTonic for the complete usage rules.
Manipulating text with Regex
Go further
REGEXMATCH()
Checks whether a text follows a format or a rule (returns true or false).
Or continue with
Formula glossary
All available operators and functions, sorted by category.