Transport Rules, RegEx (Ish).

Brass Contributor

Hey Team, 

 

We have a need to block any emails that come from; 

 

  • domain.com 
  • sub.domain.com
  • dom.domain.com

 

I have created a transport rule and it works as expected, I chose Sender Address Matches Pattern:

 

domain.com$

 

That all works as expected. However in reading the documentation I understand I am supposed to escape the ($) character. That is the part I am having an issue with. Do i really need to escape the dollar sign? it comes at the end of the expression. 

 

Regular Expressions in Transport Rules: Exchange 2010 Help | Microsoft Docs

 

block domain.PNG

 

Thanks, 

 

Robert 

3 Replies

@Robert Bollinger 

Yes, $ is working, you can refer below URL on some sharing as well, it embedded a link for regex test as well:

 

How to block only .co and not .com : Outlook (reddit.com)

Sorry i don't think i understand your reply. I want to block:

domain.com
sub.domain.com
dom.domain.com
(all subdomains + the parent domain)

That is working. I just want to understand why or if I need the "\" character in addition to what i already have.

Thanks,

Robert

@Robert Bollinger 

Please test your string by following:

 

https://regex101.com/r/MPLDZr/1/