Skip to main content

Regular Expressions in Email Processing Rules

Regular expressions are used in email processing rules to control which emails the platform accepts and which import process they trigger.

Regular expressions are used in email processing rules to control which emails the platform accepts and which import process they trigger. When you configure an email processing rule, you define patterns that the platform matches against the sender address, subject line, and attachment filename of each incoming email. Those patterns are regular expressions.

Understanding how regular expressions work will help you configure rules that match exactly the emails you intend, without inadvertently accepting emails you do not.


What a regular expression does

A regular expression is a pattern that describes a set of possible text strings. The platform tests each incoming email against the patterns you define and triggers an import process only when the email matches.

The simplest pattern is an exact string. The expression a.sender@mycompany.com matches only that precise address. More useful are patterns that match a range of values, which is where special characters come in.

Two characters do most of the work in practice. A full stop (.) matches any single character. An asterisk (*) means the preceding element can repeat zero or more times. Combined, .* matches any sequence of characters of any length. So the expression .*@mycompany.com matches any email address from any sender at mycompany.com, while .* on its own matches anything at all.

If you need to match a literal full stop rather than treat it as a wildcard, prefix it with a backslash: \\. matches a full stop character exactly.


Pattern reference

The table below covers the elements most relevant to email processing rule configuration.

Pattern

Meaning

.

Any single character

[0-9]

Any digit from 0 to 9

\\.

A literal full stop

*

Zero or more of the preceding element

+

One or more of the preceding element

{n}

Exactly n repetitions of the preceding element

A few examples to illustrate:

  • a* matches zero or more a characters (including an empty string)

  • [0-9]+ matches one or more digits

  • \\.{3} matches exactly three consecutive full stops


Practical examples for email rules

Expression

What it matches

a.sender@mycompany.com

That exact address only

.*@mycompany.com

Any address at mycompany.com

.*

Any text string

report_[0-9]+\\.csv

Filenames like report_1.csv, report_042.csv

When configuring sender rules, start with the most specific pattern that covers your expected senders. Using .* as a sender pattern accepts emails from anyone, which may not be the intended behaviour.

For more information on configuring email processing rules, see Receiving Data by Email.

Did this answer your question?