Regular expressions
How to use regex inside the Data processing block
In the Data processing block you can run pattern-based search and replace. Regex lets you describe structure instead of matching a fixed literal string.
What is a regular expression?
A regular expression is a formal pattern used to locate text. It powers extraction, substitution, and lightweight parsing based on shape rather than exact copies.
Worked examples
| Input | Pattern | Replacement | Result |
|---|---|---|---|
Last name: Ivanov, First name: Sergey | Last name: (\w+), First name: (\w+) | \2 \1 | Sergey Ivanov |
Phone: +1 (123) 456-78-90 | \D | | 11234567890 |
Date: 2025-06-26 | (\d{4})-(\d{2})-(\d{2}) | \3.\2.\1 | Date: 26.06.2025 |
Email: test@mail.com | \w+@\w+\.\w+ | hidden | Email: hidden |
Anatomy of a regex
Literal characters
abcMatches the exact substring abc.Any single character except newlineCharacter classes
| Pattern | Meaning |
|---|---|
\d | Digit (0–9) |
\D | Non-digit |
\w | Word character (letter, digit, underscore) |
\W | Non-word character |
\s | Whitespace (space, tab, newline) |
\S | Non-whitespace |
[abc] | Exactly one of a, b, or c |
[^abc] | Any character except a, b, or c |
[a-z] | Any character from a through z |
Quantifiers
| Pattern | Meaning | Sample matches |
|---|---|---|
a* | Zero or more repeats | "", "a", "aaaa" |
a+ | One or more repeats | "a", "aa", "aaa" |
a? | Zero or one repeat | "", "a" |
a{3} | Exactly three repeats | "aaa" |
a{2,4} | Between two and four repeats | "aa", "aaa", "aaaa" |
a{2,} | Two or more repeats | "aa", "aaaaa" |
Anchors
| Pattern | Meaning |
|---|---|
^ | Start of line |
$ | End of line |
\b | Word boundary |
\B | Not a word boundary |
Groups and alternation
| Pattern | Meaning |
|---|---|
(abc) | Capturing group—saved for backreferences. |
(?:abc) | Non-capturing group |
abc|def | Alternation: match abc or def |
Replacement templates
Reference capturing groups from the pattern inside your replacement string:
\\1\\2Capture groups numbered in opening orderGroup backreference walkthrough
| Field | Value |
|---|---|
| Input | Last name: Ivanov, First name: Sergey |
| Pattern | Last name: (\w+), First name: (\w+) |
| Replacement | \2 \1 |
| Output | Sergey Ivanov |
Metacharacters
Several symbols are reserved. Escape them with a backslash (\) when you need the literal character:
| Symbol | Role |
|---|---|
. | Any character |
* | Quantifier |
+ | Quantifier |
? | Quantifier / optional |
( ) | Grouping |
[ ] | Character class |
{ } | Repeat count |
\ | Escape |
To match a literal dot, write \.; an unescaped dot matches any character.
Recommendations
- Prototype patterns in a debugger such as https://regex101.com/.
- Add capturing groups whenever you need to rearrange substrings.
- Keep complex expressions readable with parentheses and inline notes while iterating locally.
