procmail
[Top] [All Lists]

Re: Regex help

2003-04-21 09:20:29
On 21 Apr, Jim Raney wrote:
| I've got this regex here:
| 
| ^Received:.*\/\[[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\]$sby$smy.host.name
| 
| to grab a certain received line of the headers.  What I'd like it do is
| also ignore any line where the match is [127.0.0.1] and keep searching for
| the next matching line (or find the very last match of the above).  Can
| anyone give me any pointers on how to do that?

The short answer is probably not with a single regular expression (at
least not without lookaheads, which procmail doesn't have).  You can
process multiple Received: headers using recursion and/or scoring, with
the latter probably preferred for something pretty simple like this. 
There was a discussion here earlier this month that was similar to your
question. The thread might be instructive. It starts here:

http://www.xray.mpe.mpg.de/mailing-lists/procmail/2003-03/msg00268.html

continues the next month here:

http://www.xray.mpe.mpg.de/mailing-lists/procmail/2003-04/msg00004.html

with a solution here:

http://www.xray.mpe.mpg.de/mailing-lists/procmail/2003-04/msg00112.html

It's not exactly the same, but very close, and can probably get you on
your way.

-- 
Email address in From: header is valid  * but only for a couple of days *
This is my reluctant response to spammers' unrelenting address harvesting



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