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

expression filter tips

Hello to all,

I searched for some tips in this forum to use the expression filter, with any result.

So after three days of work with try and error and reading books about PCRE, here some tips about the expression filter.

You get mails like this "RE: xcvbVjjagra"?

try this "(?i)(re|fw|fwd)\:\s\w+(?i)agra\b"

(?i) means "ignore case sensitivity to the following expression"
(x|y) is a enumeration of expressions in this case RE, FW and FWD
\: for the colon, without this it didn`t work. It says that the colon is just a colon.
\s one whitespace
\w+ one or more word characters like "xcvbVjj" 
(\w stands for word character and the following + for "one or more" 
(?i)agra means "agra" not case sensitiv
\b end of word

or try this:

(?i)(re|fw|fwd)\:\s\w+R\w+(?i)lex\b

works against Re: jsdhRoalex

You want to filter short words like "drugs", but you are afraid about image- or pdf-streams with this expression.

(?i)\bdrugs\b

first \b means wordbeginning, second \b means end of word. 

You get also mails with one image and many words without bad words?

filter image001.gif

I found out that almost all images in this mails have this name. Ok, there are maybe some good mails with this imagename in it, but the most images have good names like "error.gif" I think.

If someone has more good tips, this will be a good thread for newbies which want to use the expression filter.

cheers
bxxp

two links about regular expressions

http://en.wikipedia.org/wiki/Regular_Expression
http://de.wikipedia.org/wiki/Regular_Expression ...for people like me :-)


This thread was automatically locked due to age.
  • Hi!

    I have noticed that inline gif attachments get pass spamassassin if they have a name that is of both characters and digits. ex image001.gif

    This was the old. Only cough things like sex.gif error.gif and so on..
    full     SARE_GIF_ATTACH   /name=\"?[0-9a-z._\-]{3,18}\.gif\"?/i
    describe SARE_GIF_ATTACH   Email has a inline gif
    score    SARE_GIF_ATTACH   0.75


    # With my new it catches all. I also added a higher score to kill them directly. [:D]
    full     SARE_GIF_ATTACH   /name=\"[a-zA-Z0-9.-]{3,18}\.gif\"/i
    describe SARE_GIF_ATTACH   Email has a inline gif and digits
    score SARE_GIF_ATTACH 8.000

    My changes was added to /etc/mail/spamassassin/local.cf
    Original is from /etc/mail/spamassassin/70_sare_stocks.cf

    Local.cf have more priority so it overrules the other.