Regular expressions (regex) let you analyze, clean, or validate text directly in your TimeTonic formulas, without using Excel or external scripts. They're especially useful for securing user entries, cleaning imported data (CSV, API), or validating a format (code, number, identifier).
Each function is detailed in its own article: this guide covers the rules common to all three.
Important rules to know
Before using regular expressions in TimeTonic, follow these rules to keep your formulas stable and compatible.
1. Use explicit patterns
Favor explicit character classes over shortcuts. Recommended examples:
-
[0-9]→ digit -
[A-Z]→ uppercase letter -
[A-Za-z]→ lowercase and uppercase letters -
[A-Za-z0-9]→ alphanumeric characters
Explicit patterns are more readable and avoid interpretation ambiguities.
2. Understand repetition operators
The following operators repeat a pattern:
-
+→ one or more occurrences -
*→ zero or more occurrences -
{n}→ exactly n occurrences
When an operator needs to apply to several characters, group the pattern with parentheses: without them, the repetition may only apply to the last element.
3. Escape character not supported
The \ character isn't supported in TimeTonic. So the following shortcuts shouldn't be used: \d, \D, \w, \W, \s. Use the explicit equivalents instead:
-
\d→[0-9] -
\D→[^0-9] -
\w→[A-Za-z0-9] -
\W→[^A-Za-z0-9]
This keeps your pattern compatible with the regex engine TimeTonic uses.
4. Character classes
Brackets [] define a set of allowed characters:
-
[ABC]→ matches A or B or C -
[^0-9]→ matches any character except a digit
The ^ symbol at the start of a class means exclusion.
5. Using metacharacters
To search for a metacharacter itself (., *, +, $) rather than its regex meaning, write it inside brackets:
Business use case examples
Clean up a phone number
Remove all non-numeric characters: «Tel: 06 12 34 56 78» becomes «0612345678».
What it does: [^0-9] targets anything that isn't a digit, and the empty replacement removes those characters. Only the digits remain.
Validate a code (1 uppercase letter + 5 digits)
Validate a code containing at least one uppercase letter and a series of 5 consecutive digits. On «here is the reference code T51234»:
What it does: [A-Z] requires at least one uppercase letter, .* accepts anything in between, ([0-9]){5} requires 5 consecutive digits. Result: true if both conditions are present in the text, otherwise false.
Extract an order number from a customer message
On «Hello, my order 45821 hasn't been delivered.», automatically retrieve this number in a dedicated field:
What it does: [0-9]+ extracts the first sequence of consecutive digits, no matter its position in the text. Result: 45821.
Go further
REGEXMATCH()
Checks whether a pattern is present in a text (true / false).
Or continue with
Formula glossary
All available operators and functions, sorted by category.