Skip to main content
Version: 1.28 (Current)

Regex

Audience: Low-code Engineers

Skill Prerequisites: Actions, Tokens, Regular expressions

Extracts values from a text with regular expressions and stores each one in a token. You give one Input and a list of rules. Each rule has a token name and a pattern, and gets the first match of its pattern.

For example, from an email body you can pull the order number into [OrderNumber] and the customer's email into [CustomerEmail] in one action.

note

This action needs the Scripting feature in your license. If it isn't licensed, the action fails with a "not licensed" error.

Typical Use Cases​

  • Read an order number, invoice ID or tracking code from an email or a document
  • Pull parts out of a value, for example the domain from an email address or the year from a date
  • Read a value from a text response that isn't JSON or XML
  • Check whether a text contains a pattern, then use the token in a condition

Don't use it to​

Action NameDescription
Regex - Multiple ResultsGets every match of one pattern, as CSV, JSON or XML text.
Regex ReplaceReplaces the matches of a pattern in a text.
Parse JSON Into TokensReads the values of a JSON object into tokens.
Create/Update TokensCreates or changes tokens with values you set.
Sanitize HTMLRemoves unsafe tags and attributes from HTML.

Comparing the regex actions​

ActionPatternsResult
RegexOne or more rules, each with its own pattern, on one InputThe first match of each pattern, each in its own token
Regex - Multiple ResultsOne patternEvery match, joined into CSV, JSON or XML text
Regex ReplaceOne or more rows, each with its own Input and patternThe Input with every match replaced

Input Parameter Reference​

ParameterDescriptionSupports TokensDefaultRequired
InputThe text to search, usually a token such as [EmailBody].Yesempty stringYes
Parse DataThe rules. Each row has a Store in Token name, for example OrderNumber, and a Regex Pattern, for example Order #(\d+). Rows run in order. Brackets around the token name are removed, so [OrderNumber] also works. See How values are extracted.NoemptyYes
Compile RegexCompiles the patterns for faster matching. Compiled patterns run about 30% faster but use more memory, and the first run is about 3 times slower. Use it when the action runs often with the same patterns.NofalseNo

Output Parameters Reference​

OutputDescription
[<Store in Token>]One token for each row of Parse Data, with the extracted value. It's an empty string if the pattern doesn't match.

How values are extracted​

For each row, the action looks for the first match of the pattern in the Input:

  • No groups in the pattern. The token gets the whole match. For example, \d{5} on Boston, MA 02134 gives 02134.
  • Groups in the pattern. The token gets the first group only. For example, Order #(\d+) on Order #1042 shipped gives 1042, without Order #. Other groups are ignored.
  • No match. The token is an empty string.

Group numbering follows .NET rules:

  • Unnamed groups ( ) are numbered first, then named groups (?<name> ). If the pattern has both, the first unnamed group wins. If it has only named groups, the first named group wins. The token is still named after Store in Token, not after the group.
  • Non-capturing groups (?: ) don't count. Use them when you need a group for alternatives or repetition but want the whole match, for example (?:Mr|Ms)\. \w+.

Pattern syntax and options​

  • .NET regular expressions. Patterns use the .NET syntax, such as \d, \w, \s, (?<name> ), lookaheads and inline options.
  • Case is ignored. The action always matches without case sensitivity, so order matches Order and ORDER. To match case, start the pattern with (?-i).
  • Other options. There are no settings for multiline or singleline mode. Use inline options at the start of the pattern: (?m) makes ^ and $ match at each line, and (?s) makes . match line breaks too.
  • Tokens aren't replaced in patterns. Only Input supports tokens. So bracket sets such as [a-z] or [\w.-] are safe, but you can't build a pattern from a token value. If you need that, use Regex Replace, which has an Apply tokens on pattern option.

Considerations​

  • Only the first match. Each row returns one value. To get all matches, use Regex - Multiple Results.
  • Check for no match. An empty token means the pattern didn't match, or matched an empty value. Test it in a later action's condition, for example [OrderNumber] == "". See Common Parameters.
  • Invalid patterns fail the action. A syntax error in a pattern, such as an unclosed (, raises an error when the action runs.
  • No timeout. The action doesn't set a match timeout. Patterns with nested repetition, such as (a+)+$, can take a very long time on long inputs. Keep patterns simple and specific.
  • Same token in two rows. The last row wins.

Examples​

tip

To understand how to use the below examples, please see Running Examples.

1. Read the order number and email from a message​

The EmailBody token holds a text such as Order #1042 was placed by jane.doe@example.com. This action stores 1042 in [OrderNumber] and jane.doe@example.com in [CustomerEmail]. The first pattern has a group, so only the digits are kept. The second has none, so the whole match is kept.

{
"Title": "Regex",
"ActionType": "Regex",
"Description": "Extract the order number and customer email",
"Parameters": {
"Input": "[EmailBody]",
"Data": [
{
"name": "OrderNumber",
"value": "Order #(\\d+)"
},
{
"name": "CustomerEmail",
"value": "[\\w.+-]+@[\\w-]+\\.[\\w.-]+"
}
],
"CompileRegex": false
}
}

In a later action, use the condition [OrderNumber] == "" to handle messages without an order number.

2. Split a date into parts​

The InvoiceDate token holds a date such as 2026-09-27. Each row picks a different part with a named group. Since each pattern has one group, that group is returned.

{
"Title": "Regex",
"ActionType": "Regex",
"Description": "Split the invoice date",
"Parameters": {
"Input": "[InvoiceDate]",
"Data": [
{
"name": "InvoiceYear",
"value": "^(?<year>\\d{4})-\\d{2}-\\d{2}$"
},
{
"name": "InvoiceMonth",
"value": "^\\d{4}-(?<month>\\d{2})-\\d{2}$"
}
],
"CompileRegex": false
}
}

The result is [InvoiceYear] = 2026 and [InvoiceMonth] = 09.

Revised 09/27/2026