Re: [exim] Filter separator

Top Page
Delete this message
Reply to this message
Author: Mike Cardwell
Date:  
To: exim-users
Subject: Re: [exim] Filter separator
* on the Thu, Feb 20, 2014 at 12:02:46PM -0300, Maxi Cooper - EGS wrote:

> Hi all. Have a quick question but can't find the answer anywhere. I need to
> change the separator in a filter expression, so that:
>
> ${filter{a,b,c}{!eq{$item}{b}}
>
> returns "a,c"


root@glue:~# exim4 -be '${filter{<,a,b,c}{!eq{$item}{b}}}'
a,c
root@glue:~#

> Also, can I use a AND or OR expression here, something of the sort of:
>
> ${filter{a:b:c}{!eq{$item}{b} AND !eq{$item}{c}}
> so that this returns just "a". I would try this, but doesn't see the best
> way to achieve it:
>
> ${filter{${filter{a,b,c}{!eq{$item}{b}}}{!eq{$item}{c}}



root@glue:~# exim4 -be '${filter{<,a,b,c}{and{{!eq{$item}{b}}{!eq{$item}{c}}}}}'
a
root@glue:~#

> FYI, I need this to filter some addresses in a custom filter, where I need
> to remove two specific addresses from certain emails, so that "a,b,c" would
> actually be $h_To.


Be careful with that. "To" headers can contain all sorts of information. People
can have commas in their name field for example.

-- 
Mike Cardwell  https://grepular.com/     http://cardwellit.com/
OpenPGP Key    35BC AF1D 3AA2 1F84 3DC3  B0CF 70A5 F512 0018 461F
XMPP OTR Key   8924 B06A 7917 AAF3 DBB1  BF1B 295C 3C78 3EF1 46B4