On Tue, Sep 06, 2011 at 07:58:49PM +0100, Arkadiusz Miskiewicz wrote:
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug.
>
> http://bugs.exim.org/show_bug.cgi?id=1147
> Summary: builtin list counting feature
> Product: Exim
> Version: 4.76
> Platform: Other
> OS/Version: Linux
> Status: NEW
> Severity: wishlist
> Priority: medium
> Component: Unfiled
> AssignedTo: nigel@???
> ReportedBy: arekm@???
> CC: exim-dev@???
>
>
> I'm looking for a expansion feature that would allow to count elements in
> lists.
>
> For example I had recently tons of spam with:
> From: aaa@???, bbb@???, c@???, ...
> (multiple addresses in From)
>
> and I've tried to make a condition like "if count(addresses($h_from)) > 1"
>
> exim-users people came up with this ugly (but working) hack:
>
> # DEBUG #
> warn set acl_m_sender_count = ${reduce \
> {>, ${addresses:$h_from:} } \
> { 0 } \
> {${eval:$value+1}} \
> }
> logwrite = Found $acl_m_sender_count senders in From header
>
> This feature request is about adding some smart "count" expansion that would
> allow to count members in lists.
How about:
${eval:${strlen:${sg{item1, item2 ,item3, item4}{[^,]*}{}}}+1}
or in your example above, you can just test for the presence of a
comma in the string.
Steve