procmail
[Top] [All Lists]

Re: Match operator and massive regex

2001-12-04 16:26:07
I'm not entirely convinced that I understood the problem, so please do
clarify if I missed the point at all.

Query summary: The regexp below matches in some unforseen ways. I want
to understand how this occurs. How the matching actually works
(internally) so I can adjust it to get the results I need.

Have you tried turning on VERBOSE logging so that procmail gives you
more details about what it is doing?

Incoming message has:
   Newsgroups: comp.lang.awk
It gets written to mbox file:  
   1x.comp.lang.awk.in

OK

========================================
## Match Newgroup names to one of newsrc list to form DELIVERY file name
  :0fh
* Newsgroups:[     ]*\/(comp\.editors|comp\.emacs|comp\.emacs|comp\.lang\.awk)
{
   DELIVERY=$MATCH
}

## If we have a bonafide `PATH: ' header then write it to DELIVERY
 :0
* ^Newsgroups:
* ^Path: 
 1x.${DELIVERY}.in
========================================

The first recipe sets DELIVERY to the newsgroup name *IF* one of the
given newsgroups is on the "Newsgroups:" line.  Unless you set DELIVERY
somewhere else, ${DELIVERY} will be empty in other cases.  (As an aside
- did you mean to put "* ^Newsgroups:..." rather than "* Newsgroups:..."?)

The second recipe can deliver to 1x.${DELIVERY}.in, even if the previous
recipe did not match.  In which case it will be delivering to 1x..in
because ${DELIVERY} will have no value.
Also, you probably want a lock file when you're delivering to the file.

Perhaps you want something like:

:0
* ^Newsgroups:[     ]*\/(...etc...)
* ^Path:
{
   DELIVERY=$MATCH

  :0 :
  1x.${DELIVERY}.in
}

Hope that's a help,
Martin
-- 
Martin McCarthy                 /</                  PGP key available
    `Procmail Companion'        \>\  http://www.ancient-scotland.co.uk
     Addison Wesley             /</    http://www.ehabitat.demon.co.uk
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>