Solved

Regular Expression Help

Posted on 2013-02-04
6
419 Views
Last Modified: 2013-02-12
Hi:

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.
0
Comment
Question by:sysadmin-inq
  • 4
6 Comments
 
LVL 9

Expert Comment

by:user_n
ID: 38854013
What language do you use to write the regular expression
0
 

Author Comment

by:sysadmin-inq
ID: 38854064
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:
(mycompetitor.com|mycompetitor.net)"

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,
0
 
LVL 13

Expert Comment

by:Carl Bohman
ID: 38855335
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
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:sysadmin-inq
ID: 38856083
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.

Thanks,
KS
0
 

Accepted Solution

by:
sysadmin-inq earned 0 total points
ID: 38864732
Found a regex that allowed me to limit the inbound/ outbound to only the two domains.
^((?!(domainA|domainB)).)*$
0
 

Author Closing Comment

by:sysadmin-inq
ID: 38879457
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.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have been reconstructing a PHP-based application that has grown into a full blown interface system over the last ten years by a developer that has now gone into business for himself building websites. I am not incredibly fond of writing PHP code o…
Do you hate spam? I do, and I am willing to bet you do as well. I often wonder, though, "if people hate spam so much, why do they still post their email addresses on the web?" I'm not talking about a plain-text posting here. I am referring to the fa…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now