The REGEXEXTRACT() function is used to extract specific information contained in free text, using a regular expression.
Regex function name:
REGEXEXTRACT()
Syntax
REGEXEXTRACT(text, regular_expression)ℹ Calling function parameters in TimeTonic:
- $field_name = field (link, linked table column, number, selection, formula, text...).
- "free text" = free text to be added between quotation marks.
- do not use quotation marks for numbers.
Parameters
| Parameter | Description |
|---|---|
text |
Source text containing the value to extract |
regular_expression |
Search pattern to extract a value from the text. |
Example
1) Extract an order number from a customer message
REGEXEXTRACT("Hello, my order n°24158 has still not been delivered.",
"[0-9]+")Result: "24158"
The role of the regex:
- [0-9]+ → extracts a sequence of consecutive digits.
- The function returns the first match found.
2) Extract an email address from free text
REGEXEXTRACT("You can reply to me at the following address: voici@monemail.com. Thank you.",
"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+[.][A-Za-z]{2,}") Result: "voici@monemail.com"
The role of the regex:
- [A-Za-z0-9._%+-]+ → email identifier
- @ → mandatory separator
- [A-Za-z0-9.-]+ → domain name
- [.][A-Za-z]{2,} → extension (.com, .fr, etc.)
Notes
- Works only on text.
- If no match is found, the function returns an empty value.
- ℹ️ The character \ and some shortcuts (\d, \w, \s) are not supported.
See Introduction to REGEX() functions in TimeTonic for the complete usage rules.
Return type
The function returns text (or multiple columns in case of groups).
The output type format of the result can be configured in the options of the formula field editor. For more details, see Output format options in the Formula column article.
Best practices
Use REGEXEXTRACT() when:
- LEFT() / RIGHT() are no longer sufficient
- The data position is variable.
- The text is long or heterogeneous.
- Several values coexist in the same string.
- You work with user messages, imports, or API.
Text manipulation with Regex
| Function | Action | What is it for? |
|---|---|---|
| REGEXMATCH() | Validate | Check if a text meets a format or a rule (returns true or false). |
| REGEXEXTRACT() | Extract | Retrieve specific information contained in unstructured text. |
| REGEXREPLACE() | Clean / transform | Dynamically replace or delete parts of a text based on a pattern. |