A regular expression is a text pattern: "ORD, a dash, digits" or "two letters, four digits". The built-in business process actions in Bitrix24 have no regular expressions: extracting an order number from an email subject, validating a SKU format or cutting a link out of a comment can't be done with standard tools. Let's cover how to solve these tasks with two robots: one finds and extracts matches by pattern, the other performs a replacement by pattern. Both work in the workflow designer alongside the built-in actions.

Why regular expressions in a business process?

A lead is created from an email, and the order number is left in the subject: "Order ORD-12345: question about delivery". A deal comment holds a link to a form, a company field has an extra prefix. The data is there, but it's buried inside text, and the process needs a separate value: find the deal by the order number, fill a field with the link, validate input by the SKU. The built-in actions can't do this: conditions compare a field value as a whole — "equals", "contains" — and substitutions insert it as is, without transformation. A regular expression describes the fragment you want with a pattern and finds it in a string of any length and structure. In Roboteka two robots handle this: extraction and replacement.

How do I extract a number, code or link from text?

The Extract by regular expression robot takes the source string, a pattern and a capture-group number: 0 — the whole match, 1 and up — a parenthesized part of the pattern. The output: the first match, a list of all matches as a multiple value, and a "Found" flag (Y/N). For the subject "Order ORD-12345" the pattern ORD-\d+ returns ORD-12345, while ORD-(\d+) with group 1 returns just the digits. You can write the pattern without delimiters: the robot wraps it itself and handles Cyrillic correctly. The found value is written by the next action into an entity field or a business process variable, and on the Y/N flag you build a separate branch for the case where there are no matches.

How do I validate a field format before the next stage?

The same robot works as a format check. The task: don't let a deal move on through the stages until the SKU is brought to the AB-1234 form. The built-in condition can do "equals" and "contains", but it can't describe a value's format. The solution: the robot applies the pattern /^[A-ZА-Я]{2}-\d{4}$/ to the field value — the ^ and $ anchors require the whole string to match, and such patterns are specified with /…/ delimiters. Then a condition on the "Found" flag: Y — the process moves on, N — the rep gets a task to fix the value, and the check repeats. The same way you validate a tax ID, a contract number, a promo code — first of all the fields that feed documents and integrations: an error in those surfaces at the customer's end.

How do I replace matches by pattern?

The Format string by regex robot performs a replacement in the PHP preg_replace style. Input: the source string, a regular expression with delimiters, and a replacement string where $0 is the whole match and $1 and $2 are groups. Output: the result and a success flag; on a pattern error the robot returns the source string unchanged, and the success flag shows the error. Examples: the pattern /\D+/ with an empty replacement string leaves only the digits of a phone; /(\d{4})-(\d{2})-(\d{2})/ with the replacement string $3.$2.$1 turns the date 2026-06-12 into 12.06.2026. The result is written back into the same field — values are brought to a single form right inside the process, with no exports and no manual cleanup.

Which patterns cover the typical tasks?

A number from text — \d+; strip everything but digits — a replacement by /\D+/ with an empty string. A link — https?:\/\/\S+ (forward slashes inside the pattern are escaped). An email from arbitrary text — \S+@\S+\.\S+. An order code — ORD-\d+, and if you only need the digits, ORD-(\d+) with capture group 1. The rule about delimiters: a pattern starting with a letter, digit or backslash the robot wraps itself; a pattern starting with a special character like the ^ anchor, specify with /…/ delimiters explicitly. A new pattern is worth testing on a test deal: on an error in the expression, extraction returns "Found = N", and the condition branch shows it right away, not on live data.

Conclusion

The combination is simple: Extract by regular expression pulls data out of text and validates formats, Format string by regex brings it to the form you need. Both robots are in the text robots catalog, install for free from the Bitrix24.Market and look in the workflow designer like ordinary actions. No robot for your task? Describe it and we'll build it for free and add it to the shared library.