Re: [exim] nwildlsearch

Page principale
Supprimer ce message
Répondre à ce message
Auteur: John Burnham
Date:  
À: 'exim-users@exim.org'
Sujet: Re: [exim] nwildlsearch
> So your answer suggests that I am right.

I think I'm confused about what you're asking then.
>
> However, I read the documentation and it is not fully clear at that
> point. It is clear that /lsearch/ match the begin of the
> search key.


No. It matches the whole key. Let's use exim -d -be to run some tests. Let's have a file called /tmp/test containing

foobar: one
foo: two
foobarbaz: three

So if I do exim -d -be

> ${lookup{foo}lsearch{/tmp/test}{$value}fail}

search_open: lsearch "/tmp/test"
search_find: file="/tmp/test"
key="foo" partial=-1 affix=NULL starflags=0
LRU list:
:/tmp/test
End
internal_search_find: file="/tmp/test"
type=lsearch key="foo"
file lookup required for foo
in /tmp/test
lookup yielded: two
two

So, the fact that foobar begins with foo is irrelevant - the key is foo and foo is all it matches. It matches the first occurrence in the file though so if I alter /tmp/test to

foobar: one
foo: two
foobarbaz: three
foo: four

and rerun the above test I still get

> ${lookup{foo}lsearch{/tmp/test}{$value}fail}

search_open: lsearch "/tmp/test"
search_find: file="/tmp/test"
key="foo" partial=-1 affix=NULL starflags=0
LRU list:
:/tmp/test
End
internal_search_find: file="/tmp/test"
type=lsearch key="foo"
file lookup required for foo
in /tmp/test
lookup yielded: two
two

and the entry of
foo: four
is irrelevant.

> But
> what about the /(n)wildsearch/? There is nothing in the documentation
> except that this might be the same than with /lsearch/.
>
> And with this assumption the /(n)wildsearch/ also matches the begin of
> the search key.


But it doesn't match the beginning of the key - it matches the whole key.

> So if I match with ^...$ (or ^\N...$\N
> without the "n")
> I should match the full search key?


I believe so but I'm still not sure I understand your question - could you give an example of what you're trying to do ?

Thanks,
John