Skip to content

Regular expression (Regex)

A regular expression (Regex) is a sequence of characters that defines a search pattern in text. In automation, regular expressions are used to find, extract, or validate information, such as a phone number or email address in an incoming message.

Source content checked . English translation published 2026-10-27.

In business automation

Messages, emails, and forms sometimes arrive as free text, and a process needs to find the important value within them. A regular expression defines the value's pattern, making it possible to extract it or check that it is valid before continuing.

Examples

These examples illustrate a possible workflow. Adapt the connections and rules to your own systems.

Extracting an order number from a customer email

A customer writes a free-form email and mentions an order number. The process runs a regular expression to find the number pattern, retrieves the order from the system, and attaches it to the inquiry. If no match is found, the inquiry is routed to an agent.

Relevant tools

n8n
In text processing steps, you can use a regular expression to extract a value. Test the pattern on real messages before enabling it.

What to check

  • A pattern that is too broad will also match irrelevant text, while one that is too narrow will miss legitimate formats.

Related terms

Sources