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

Góra strony
Delete this message
Reply to this message
Autor: Tony Finch
Data:  
Dla: Thomas Mueller
CC: exim-users
Temat: 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}}