Regular expressions are a powerful, flexible way to evaluate a character sequence for matching against a given series of characters. Typically, a regular expression is written in a programming language such as C++ or C#. The regular expression can then be interpreted by a regular expression processor. The processor examines the character sequence and identifies parts that match the provided characters.
You can create a Transport Rule based on regular expressions in the Exchange Management Shell (EMS) by using the
New-TransportRule cmdlet. When you use the Conditions parameter, the Exchange regular expression implementation is used. You can use regular expressions in any predicate that accepts the "Patterns" predicate property.
Transport Rule conditions and exceptions consist of one or more predicates. Predicates instruct the Transport Rules agent on a Hub Transport server (or the Edge Rules agent on an Edge Transport server) to examine a specific part of an email message. Those specific parts include sender, recipients, subject, other message headers, and message body. Then, the Transport Rule determines whether the rule should be applied to that message. Therefore, predicates act as building blocks for conditions and exceptions.
In the Exchange Management Console, you can use regular expressions with any condition or exception that contains the words "text patterns." For example, you can use regular expressions with the following condition:
"when the From address contains text patterns"
Note The "Patterns" predicate accepts a regular expression that can be used to match text that follows an identifiable pattern. You must enclose the expression in quotation marks (").