Avatar of s-w
s-w
Flag for United States of America asked on

Exchange 2010 Transport Rule Regex not working as expected

I'm trying to match a numeric header value to between 300 and 999.

The condition is "when the message header matches text patterns"

I'm using ^(3|4|5|6|7|8|9)\d\d$ based on https://technet.microsoft.com/en-us/library/aa997187%28v=exchg.141%29.aspx

It's working for 300-999, but it's also matching values like 85 and 215.  It seems to match any value with at least 2 digits.

Is my regex correct?  Does regex work correctly for header values?
ExchangeRegular Expressions

Avatar of undefined
Last Comment
Dan Craciun

8/22/2022 - Mon
Mark Bullock

You don't need the parentheses unless you are replacing the value.
Here is the simplest regex.
[3-9]\d\d

Open in new window


You can test it here.
http://regexr.com/3asi6
s-w

ASKER
The [] and - syntax isn't shown as supported for the Transport Rules Regex.  See the Exchange link.  The regex I have works on test sites, it just doesn't work 100% of the time on Exchange.
ASKER CERTIFIED SOLUTION
Dan Craciun

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
s-w

ASKER
^(3\d\d|4\d\d|5\d\d|6\d\d|7\d\d|8\d\d|9\d\d)$ works better.  It missed a single 945 over several days.

It's not a fix for what seems to be an Exchange bug, but a reasonable workaround.

Thanks.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Dan Craciun

You're welcome.