Re: [exim] In-line Exim filter with regex

Page principale
Supprimer ce message
Répondre à ce message
Auteur: John Horne
Date:  
À: Exim users
Sujet: Re: [exim] In-line Exim filter with regex
On Wed, 2005-05-25 at 17:49 +0100, John Horne wrote:
> Hello,
>
> Using Exim 4.51 I have a redirect router which specifies an in-line Exim
> filter:
>
> ==========================================================
> data = # Exim filter\n\
>        logfile /var/log/exim/reject.log\n\
>        if ${quote:$h_X-Spam-Status:} matches "\\Nscore=(\\d+)\\N"then\n\
>              logwrite "$tod_log $message_id Blackholed by spam dump:
> score is $1"\n\                         (this is all one line)
>        else\n\
>              logwrite "$tod_log $message_id Blackholed by spam dump"\n\
>        endif\n\
>        seen finish
> ==========================================================

>

Ha! Always the way, spend ages on a problem and then as soon as you send
a message out you sort the problem out within the next few minutes! :-)

The solution seems to be:

  if ${quote:$h_X-Spam-Status:} matches \"score=(.+)\" then\n\
         logwrite "$tod_log $message_id Blackholed by spam dump: score
                     is \$1"\n\


Note where the '\' are - before the quotes and the '$1'. (BTW, no idea
why I was just collecting the integer part of the score before.)


Sorry for the hassle,

John.

-- 
---------------------------------------------------------------
John Horne, University of Plymouth, UK  Tel: +44 (0)1752 233914
E-mail: John.Horne@???       Fax: +44 (0)1752 233839