procmail
[Top] [All Lists]

Re: Trouble with scoring (Was: Re: Need regex-help: inverted word search)

2005-01-05 09:11:31
Andreas Schmidt wrote:

<> On 2004.11.05 23:35, Professional Software Engineering wrote:
[ ... ]
<> >The simplistic approach might be to do the following (this assuming  
<> >the To: field is indeed what you're looking to match on):
<> >
<> >:0
<> >* ^To:\/.*
<> >* -1^0
<> >* 1^1 TO ?? @server
<> >* -1^1 TO ?? myname(_at_)server
<> >
<> 
<> I just noticed that this recipe doesn't work as it should. I understand  
<> what it is supposed to do, but when I test it with real mail, it  
<> somehow doesn't work:
[ ... ]
<> Does anyone know why only 0 is added in the last two conditions?

I think Sean expected $TO to be set by some previous recipe.  Because
you don't have it set, the evaluation is against an empty variable, so
doesn't match, so get's a zero.

You could either set $TO or use $MATCH:

  :0
  * ^To:\/.*
  { TO=$MATCH }

  :0
  * -1^0
  *  1^1 MATCH ?? @server
  * -1^1 MATCH ??  myname(_at_)server

or

  :0
  * ^To:\/.*
  * -1^0
  *  1^1 MATCH ?? @server
  * -1^1 MATCH ??  myname(_at_)server

Generally accepted wisdom says that if you are going to extract
information from a message and use it more than once, then it makes
sense to do the extraction only once and stuff the results into a
variable.  Some people set lots of variables (raises hand)

Reto
-- 
R A Lichtensteiger              rali(_at_)tifosi(_dot_)com

                Newsflash: You're not cute when I'm angry

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail