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

InputPatternReplacementResult
Last name: Ivanov, First name: SergeyLast name: (\w+), First name: (\w+)\2 \1Sergey Ivanov
Phone: +1 (123) 456-78-90\D11234567890
Date: 2025-06-26(\d{4})-(\d{2})-(\d{2})\3.\2.\1Date: 26.06.2025
Email: test@mail.com\w+@\w+\.\w+hiddenEmail: hidden

Anatomy of a regex

Literal characters

abcMatches the exact substring abc
.Any single character except newline

Character classes

PatternMeaning
\dDigit (0–9)
\DNon-digit
\wWord character (letter, digit, underscore)
\WNon-word character
\sWhitespace (space, tab, newline)
\SNon-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

PatternMeaningSample 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

PatternMeaning
^Start of line
$End of line
\bWord boundary
\BNot a word boundary

Groups and alternation

PatternMeaning
(abc)Capturing group—saved for backreferences.
(?:abc)Non-capturing group
abc|defAlternation: match abc or def

Replacement templates

Reference capturing groups from the pattern inside your replacement string:

\\1\\2Capture groups numbered in opening order

Group backreference walkthrough

FieldValue
InputLast name: Ivanov, First name: Sergey
PatternLast name: (\w+), First name: (\w+)
Replacement\2 \1
OutputSergey Ivanov

Metacharacters

Several symbols are reserved. Escape them with a backslash (\) when you need the literal character:

SymbolRole
.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.