procmail
[Top] [All Lists]

Re: Matching the first occurrence of a header field

2002-04-07 12:16:02
Romildo followed up.

| And what about if I want to look only at the _second_ occurrence
| of the Received: header? Is it possible? How?

By the way, I've been assuming that by "first" and "second" Received: headers
you've meant the first and the second from the top rather than the first and
the second in the transmission history (which would be the bottommost and the
second from the bottom).  I should have brought that up in my first response,
especially because I've mentioned it in the past.

Second from the top, yes, because matching to the left of \/ is stingy;
second from the bottom, not within procmail as far as I can see.  To check
only the second Received: header from the bottom would probably require
forking another program (for example, by saving the output of
formail -cxReceived: in a variable and using that variable as the search
area).

:0 flags # examine only second Received: header from the top
* ^Received:(.+$)+\/Received:.+
* MATCH ?? regexp
action

Note that this very similar code would search every Received: header except
the topmost/newest:

:0 flags
* ^Received:(.+$)+Received:.*regexp
action



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