Extract by regular expression
The Extract by regular expression robot searches a string for matches of a given pattern inside Bitrix24 business processes and robots. It takes a source string, a regular expression, and a capture group number (0 means the whole match). It returns the first match, the list of all matches, and a Y/N found flag.
The robot applies a regular expression to a source string and collects every match. The pattern can be given without delimiters — the robot wraps it in /…/u itself, so Unicode text is handled correctly. The capture group number lets you return a specific part of the pattern instead of the whole match, for example a value captured in parentheses. Typical cases: pulling an order number like ORD-12345 out of the email subject a lead was created from, or extracting every link from a deal comment. The robot returns the first match, the full list of matches (a multiple value), and a Y/N found flag. In the next workflow steps, write the extracted value to an entity field or branch on the Y/N flag when there is no match.
What input parameters does the robot accept?
| Parameter | Type | Required? | Default |
|---|---|---|---|
| Source string | string | yes | |
| Regular expression | string | yes | |
| Capture group number (0 = whole match) | int | — |
What does the robot return?
| Parameter | Type |
|---|---|
| First match | string |
| All matches | string |
| Found (Y/N) | string |
Scenario: extracting an order number from an email subject
- A lead is created from an inbound email — the title contains 'Order ORD-12345: delivery question'
- The robot applies the pattern ORD-\d+ and returns the match ORD-12345
- The workflow writes the order number to a lead field and finds the related deal