This page describes a feature that hasnโt launched yet. Details may change before release.
Multiple Conditions
Standard rules match on a single condition. Advanced Rules let you combine multiple conditions using AND or OR logic.
AND (All conditions must match)
IF the email is from
@bigclient.comAND the subject containsinvoiceTHEN add the “Priority Billing” label
Both conditions must be true for the rule to fire. This is useful for narrowing down which messages a rule applies to.
OR (Any condition must match)
IF the subject contains
invoiceOR the subject containsreceiptTHEN add the “Finance” label
Only one condition needs to be true for the rule to fire. This is useful for catching messages that could match in different ways.
Each advanced rule uses either AND or OR โ you can’t mix them in a single rule. If you need more complex logic, create separate rules.
Regular Expression Matching
For conditions that need more precision than simple “contains” matching, you can use regular expressions (regex). This lets you match patterns rather than exact text.
What’s Supported
Regular expressions use standard syntax. Some useful patterns:
| Pattern | Matches | Example |
|---|---|---|
\d |
Any digit | INV-\d+ matches “INV-1234” |
\w |
Any word character | \w+@example\.com matches “alice@example.com” |
\s |
Any whitespace | invoice\s*# matches “invoice#” and “invoice #” |
[abc] |
Any character in brackets | [bc]at matches “bat” and “cat” |
a|b |
Either a or b | invoice|receipt matches either word |
^ / $ |
Start / end of text | ^Re: matches subjects starting with “Re:” |
+ |
One or more | \d+ matches one or more digits |
* |
Zero or more | \d* matches zero or more digits |
? |
Zero or one | colou?r matches “color” and “colour” |
All regex matching is case-insensitive, just like standard contains matching.
Safety Limits
To keep things running smoothly, regex patterns have a few deliberate limits:
- Maximum length: Patterns can be at most 200 characters long
- No backreferences: Patterns like
(foo)\1are not allowed, as they can cause performance issues - Timeout: If a pattern takes too long to evaluate (more than 1 second), it’s treated as not matching
These limits are in place to prevent patterns that could slow down message processing for your whole team.
If you’re not familiar with regular expressions, the standard “contains” matching will cover most use cases. Regex is there for when you need more precision โ like matching email addresses with a specific pattern, or subjects that follow a particular format.
Examples
Route invoices with specific numbering:
- Conditions (AND): Subject matches regex
INV-\d{4,}, From address contains@supplier.com - Actions: Add “Invoices” label, Assign to Alex
Catch emails from multiple domains:
- Conditions (OR): From address matches regex
@(alpha|beta|gamma)\.com - Actions: Add “Partners” label
Filter automated notifications by pattern:
- Conditions (AND): From address contains
noreply@, Subject matches regex^(Alert|Warning|Notice): - Actions: Skip the inbox and archive
Match ticket references across fields:
- Conditions (OR): Subject matches regex
(TICK|SUP)-\d+, Body matches regex(TICK|SUP)-\d+ - Actions: Add “Tickets” label, Forward to
tickets@helpdesk.example.com