8 Nov 2010 12:47
Re: lookup function with no regular expresion
Sam Varshavchik <mrsam <at> courier-mta.com>
2010-11-08 11:47:45 GMT
2010-11-08 11:47:45 GMT
Fernando Gozalo writes:
> El 06/11/10 01:11, Sam Varshavchik escribió:
>> Fernando Gozalo writes:
>>
>>> Hello,
>>>
>>>>> I need to know if there is an 'option' I can pass to the builtin
>>>>> 'lookup' function such as it treat 'expr' as pure text and not as a
>>>>> regular expression.
>>>>
>>>> Use the escape() function, then pass the result to lookup().
>>>
>>> I don't get the results that I expect. I want to find email addresses
>>> in a file.
>>>
>>> [fgozalo <at> lunes ~]$ cat archivo
>>> fgozalo <at> csi.uned.es
>>> fgozalo+prueba1 <at> csi.uned.es
>>>
>>>
>>> - Without escape():
>>>
>>> lookup("fgozalo <at> csi.uned.es", "archivo") ==> MATCH
>>> lookup("fgozalo+prueba1 <at> csi.uned.es", "archivo") ==> NO MATCH
>>>
>>> - With escape():
>>>
>>> lookup("fgozalo <at> csi\.uned\.es", "archivo") ==> NO MATCH
>>> lookup("fgozalo\+prueba1 <at> csi\.uned\.es", "archivo") ==> NO MATCH
>>
>> Sorry -- I got confused a little bit, here.
>>
>> It's the /external file/ that contains regular expressions, that get
>> matched against the literal string you pass to lookup(). So, what you want:
>>
>> [mrsam <at> octopus maildrop]$ cat archivo
>> ^fgozalo <at> csi\.uned\.es$
>> ^fgozalo\+prueba1 <at> csi\.uned\.es$
>>
>> Then, use lookup("fgozalo <at> csi.uned.es", "archivo"), etc…
>
> I've read again the definition of lookup() and seen "filename is a name
> of a file containing *a list of patterns*". Sorry.
>
> Well, I explain what I need:
>
> The /external file/ contains email addresses, not regular expressions.
> In the example file (archivo) the "." and "+" are not wildcards, are
> separators.
>
> I need to look for "fgozalo+prueba1 <at> csi.uned.es" in "archivo" and have a
> hit. Can I do it with lookup()? or with a combination of builtin functions?
You'll have to use an external script to do that, and invoke it from a
maildrop recipe.
------------------------------------------------------------------------------ The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________ Courier-maildrop mailing list Courier-maildrop <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/courier-maildrop
RSS Feed