logo
search
Others

How to Use Wildcards and Regular Expressions in Exchange Online Transport Rules

Maira MehtabMaira Mehtab Sep 21, 2026 868 views

Question details

The user needs to configure an Exchange Online mail flow rule to match specific subject formats, such as 'Invoice123456', but wildcard patterns are not working.

Product
Exchange Online
Device & OS
not provided
Scenario
Setting up a mail flow rule for a shared mailbox to properly filter or route messages based on specific strings in the subject line.
Observed behavior
Using the wildcard pattern 'Invoice.*' does not trigger the rule as expected because the system interprets the wildcard characters literally rather than dynamically.
Before you start

Ensure you have Exchange Admin Center privileges to manage mail flow rules, and be aware that newly created or modified transport rules can take up to 30 minutes to fully propagate.

Solution 1Recommended

Use Simple Keywords Instead of Literal Wildcards

Use specific keywords when you need to match a string containing a certain word, as wildcard characters like .* are often treated as literal text in basic conditions.

In many Exchange transport rule fields, regular expression syntax like .* is not recognized and is interpreted literally. This means the rule looks for the exact string 'Invoice.*' instead of 'Invoice' followed by any characters.

1
Access Mail Flow Rules

Log in to the Exchange Admin Center and navigate to the Mail flow > Rules section.

2
Edit the Matching Condition

Select and edit your mail flow rule. Locate the condition for 'The subject or body includes'.

3
Enter the Keyword

Instead of typing 'Invoice.*', enter the exact keyword 'Invoice'. This will successfully match any subject line containing the word 'Invoice'.

Literal Interpretation: Avoid using regular expression characters in standard text-matching conditions unless the condition explicitly states it supports patterns.
Free Microsoft Office alternative

Enhance Your Daily Productivity with WPS Office

While troubleshooting complex Exchange Online mail flow rules, you might also be looking for a robust, lightweight, and cost-effective productivity suite for your everyday tasks. WPS Office is a powerful free alternative to Microsoft Office that ensures seamless migration and high efficiency.

  1. 1. Visit the Official Website: Go to the official WPS Office website to explore the features.
  2. 2. Download the Installer: Click the 'Free Download' button to download the appropriate installer for your Windows, Mac, or Linux operating system.
  3. 3. Install the Software: Run the downloaded file and follow the straightforward on-screen instructions to complete the installation.
Fully compatible with Microsoft Word, Excel, and PowerPoint file formats for seamless sharing.Lightweight software that installs quickly and saves local system resources.Familiar and intuitive user interface designed for a smooth transition with zero learning curve.An all-in-one suite to easily handle daily administrative and business document workflows.
microsoft office alternative - wps office

Frequently Asked Questions

Why aren't my multiple transport rule conditions triggering as an OR statement?

Exchange transport rules inherently use AND logic when multiple conditions are added within the same rule. To achieve an OR-like result where any one of multiple patterns triggers an action, you must create separate transport rules for each pattern.

How long does it take for a new Exchange transport rule to apply?

It can take up to 30 minutes for new or modified Exchange transport rules to fully propagate and start processing inbound or outbound emails across all servers.

How can I verify if my transport rule regular expressions are working correctly?

You can use the Message Trace feature located in the Exchange Admin Center to track incoming emails, test your configuration, and verify exactly which transport rules were triggered during processing.