Re: [Exim] regexp lookups from a file

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Tony Finch
Dátum:  
Címzett: exim-users
CC: Tony Finch, subs
Tárgy: Re: [Exim] regexp lookups from a file
On Mon, Nov 04, 2002 at 02:24:59PM +0000, Philip Hazel wrote:
>
> In Exim-speak, however, this would be a new kind of lookup because it
> doesn't fit either of the patterns of the two existing kinds of lookup.
> It can't be a single-key lookup, because you can't convert the data into
> DBM/cdb/tdb/NIS, and it doesn't quite fit the query-style approach
> either.


My hack would fit the single-key lookup mould without difficulty. The
file contains stuff like the following:

    # in case an apache list is missed by the forward_table
    s/^(apache-)?(.*)-return-\d+-.*@apache\.org$/apache-$2/i


i.e. lines may be empty or comments or Perlish s/// operators. Lookups
are similar to lsearch lookups; i.e. scan through the file, and the
first regex that matches yeilds the RHS of its s/// expression. In the
Exim config file you could just write
    ${lookup{$variable}regex{/some/file/name}}


I suppose this is significantly different to the existing single-key lookups
in that it's dynamic rather than static; section 10.4 of the spec is relevant.

Tony.
--
f.a.n.finch <dot@???> http://dotat.at/
BISCAY: NORTHWEST BACKING SOUTHWEST 4 OR 5. OCCASIONAL RAIN. MODERATE OR GOOD.