This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

regex help

I see some of you are good with regex from searching the forums. I was wondering if someone could help me. I'm trying the first regtex expression trying to block cialis in emails. at first I just put in the word cialis, but it also blocked lost of email with specialist in it. I then tried to understand the syntax of regex expressions, and thought /\ cialis/ would check for a space before the word, but that didn't block any emails for some reason. I noticed C was in capital, so I changed it to /\ cialis/i and still no luck. Anyone know what expression I could use to block emails with cialis in it, but not emails with specialist or anything other than cialis with a space in front of it? 

Thanks

Brian


This thread was automatically locked due to age.
  • Brian, since Astaro put in the CommTouch engine, none of our installations use the expression filter to stop spam.  For example, ours is empty (well, there is one entry for testing purposes: stopthisemailforspam), and I haven't seen a spam with the word cialis in it for as long as I can remember.

    On the 'AntiSpam' tab in the 'RBLs (Realtime blackhole lists)' section, do you have the 'Block dialup/residential hosts' box checked?  In the 'Advanced anti-spam features' section, do you have the 'Reject invalid HELO / missing RDNS' and 'Perform SPF check' boxes checked?

    There are some REGEX wizards here (not me!), and such expressions can be very helpful in the Web Security configuration.

    Cheers - Bob
     
    Sophos UTM Community Moderator
    Sophos Certified Architect - UTM
    Sophos Certified Engineer - XG
    Gold Solution Partner since 2005
    MediaSoft, Inc. USA
  • Hi, at least in Perl regexes (I'm not an expert on Astaro's regexes), you can use \w for a 'word boundary', so

    /\wcialis\w/i 

    might work.

    Note the spammers often use images, l33t sp34k, special html chars, etc., to obfuscate words like this so you may not have much success with regexes.

    Barry
  • Thank you for the responses. BAlfson, I am using all of those spam protection options except SPF since I didn't fully understand how it worked. I didn't want to check it to enable and have a problem before I understood it. I will read about it and try it out thanks. I'm surprised at the spam that is getting through. It's blantantly obvious spam. 

    BarryG I will try your regex expression thanks. Do you know if they work now that we are on commtouch engine as BAlfson pointed out? The help says to use regex... Thanks

    Brian
  • BarryG, not sure why but that regex isn't catching my test spam. This is the text in body of email "have all the top brands like Cialis
    Vicodin Phentermine Xanax and more for the cheapest prices around all with
    the comfort of your home so you can remain anonymous with extremely prompt
    ordering and descreet shipping."


    Maybe I have to restart the smtp service or commtouch or something. I'll schedule a restart for the weekend to make sure. Do you know if Astaro has documentation on the regex expressions for commtouch anywhere? I checked the kb didn't find anything. Thanks

    Brian
  • Brian, I don't think the Expression Filter is part of the CommTouch engine.  In any case, you definitely do not need to restart.

    [^(spe)]cialis\s will block "cialis" but not specialist

    Here's a handy REGEX tester

    Cheers - Bob
    PS Barry, I had to spend a few minutes figuring that you meant \s instead of \w
     
    Sophos UTM Community Moderator
    Sophos Certified Architect - UTM
    Sophos Certified Engineer - XG
    Gold Solution Partner since 2005
    MediaSoft, Inc. USA
  • That regex works Balfson thank you very much.

  • PS Barry, I had to spend a few minutes figuring that you meant \s instead of \w


    Nope, I meant \wcialis\w

    That would definitely work in Perl and anything that uses PCRE.

    \w detects any word boundary, including spaces (\s), periods, colons, etc., so it works better than \s.

    Barry