[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 466
  • Last Modified:

Regular Expression Help


I need some help with the correct syntax of a regular expression for my spam filter. I have two domains let's call them domainA and domainB. The spam filter in question is part of domainB and is used to restrict inbound/ outbound email to only be allowed to DomainA. Since the spam filter support regular expression, it would be ideal to have a regular expression that says if not domainA or domainB then make as spam.

I have tried ^(domainA|domainB) and ^((?!domainA$)|(?!domainB$)).*$ without success.

Can somebody please help me with the correct syntax.

Thank you.
  • 4
1 Solution
What language do you use to write the regular expression
sysadmin-inqAuthor Commented:
Usern_n, thanks for the reply the documentation for the spam filter does not say the language it just says the follow:

"A notification email is triggered when inbound or outbound message containing this value is encountered by the Rules Engine. Use regular expression to specify more than one address. For example:

In my case I want to only trigger the event / mark the email as spam if the address is not from domainA or domainB.

Thank you,
Carl BohmanCommented:
Based on a quick web search, it looks like you might be using Barracuda.  If so, this is their documentation on regular expressions: http://techlib.barracuda.com/display/CP/Regular+Expressions

This appears to include only a small number of regular expression features.  Unfortunately, none of them include negation.  If there is an option to specify that a regular expression is a whitelist instead of a blacklist, use that.

While poking around a little on Barracuda's web site, I noticed that they recommend against whitelisting domains (due to spoofing).  More information, including additional ways to configure spam filters are here: http://techlib.barracuda.com/display/BSFv51/IP+Analysis+-+Inbound+Mail
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

sysadmin-inqAuthor Commented:
Hi Bounsy,

I'm actually using software called Xeams, for the spam filter, not barracuda.  Do you know how to create the negative regex? I can test to see if negative regex works.

sysadmin-inqAuthor Commented:
Found a regex that allowed me to limit the inbound/ outbound to only the two domains.
sysadmin-inqAuthor Commented:
The regex does what I'm looking for to limit mailflow to only the two domains and marks all other domains a spam via the spam filter.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now