Re: [exim] Re: Fetch regexp for match from database

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Tony Finch
Fecha:  
A: Thomas Mueller
Cc: exim-users
Asunto: Re: [exim] Re: Fetch regexp for match from database
On Tue, 14 Jun 2005, Thomas Mueller wrote:
> Tony Finch wrote:
> >
> > I guess that'll be because if the WHERE clause is false the result of the
> > lookup is the empty string, and every string matches the null regex.
>
> This is a ugly hack, but shouldn't this work then:
> condition = ${if match{X$local_part}{X${lookup pgsql{SELECT '([0-9]+)' \
>     WHERE '${quote_pgsql:$domain}' = 'tmueller.com'}}}{yes}{no}}


match{Xfanf2}{X} is true. I suggest turning it inside-out:

    condition = ${lookup pgsql {blah sql blah} \
                    {${if match{$local_part}{$value} }} }


So you only attempt the match if the lookup succeeded. (Note that I've
abbreviated the {yes} {no} }} {no} } to }} } which is allowed by Exim
since the start of this year.)

Tony.
--
<fanf@???> <dot@???> http://dotat.at/ ${sg{\N${sg{\
N\}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}\
\N}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}