procmail
[Top] [All Lists]

Re: Procmail regext bug?

2002-03-05 01:13:19
Richard Gooch <rgooch(_at_)ras(_dot_)ucalgary(_dot_)ca> writes:
 Hi, all. I'm finding that the recipe:

:0
* ^( )fred
| (: matched; cat)> /dev/null

is not matching when I have a line in the header like this:
fred

(i.e. a space at the beginning of the line followed by "fred").
More complex variations of this regex also fail. Is this considered a
bug, or is it a case of "procmail is not egrep"?

To quote the procmail(1) manpage:
       To  make  `egrepping' of headers more consistent, procmail
       concatenates all continued header fields; but only  inter-
       nally.   When delivering the mail, line breaks will appear
       as before.

Therefore, lines in the header that begin with space or tab appear as
part of the line before them.  There's no way in procmail itself to
match the newline that's 'inside' such a continuation.  You can only
do so by calling an external program, ala:

        :0
        * H ?? ? grep '^ fred'
        | whatever...

The "H ??" tells procmail that the rest of the condition is to be applied
against just the message header.  In this case, the rest of the condition
is a program action (as indicated by the next '?') so the header is fed
into the program specified by the rest of the line.


Philip Guenther
_______________________________________________
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>