David Collantes <[EMAIL PROTECTED]> writes:

> While I wait for Jason to come back and take a look at my previous two 
> questions,

One of your two outstanding questions is my problem.  I've been busy
and only got a chance to look at it yesterday.  I've replied to it
separately.

> I wonder if someone could help me with a Python regex question. On
> the following header, I want to match the very first (from top to
> bottom) if it contains certain IP. Below is the header and my
> current 'header' regex (from INCOMING_FILTER):
> 
> Received: from atlantis.bus.ucf.edu (atlantis.bus.ucf.edu [132.170.121.25])
>       by us.olimpus.us (8.12.8/8.12.8) with ESMTP id h5QGu3Ow008784
>       (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO)
>       for <[EMAIL PROTECTED]>; Thu, 26 Jun 2003 12:56:04 -0400
> Received: from trc106021 (dyn125-212.bus.ucf.edu [132.170.125.212])
>       (authenticated bits=0)
>       by atlantis.bus.ucf.edu (8.12.8/8.12.8) with ESMTP id h5QGuSXO007279
>       (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO)
>       for <[EMAIL PROTECTED]>; Thu, 26 Jun 2003 12:56:28 -0400
> 
> 
> headers 'Received:.*132\.170\.121\.25' accept
> 
> 
> I only want a match on the first Received, not the second. What is happening 
> now is that the first is not match, but if the second has the same IP it will 
> match.

There is no way to tell, within a regular expression, if the first
Received: field matched or the second.  That is, you can't instruct an
RE to match on the nth instance of some string.  If the Received:
fields were the very first fields in the header, then it might be
possible, with some weird finagling, but often other fields precede
them, such as Delivered-To: and Return-Path:.

The one possibility I can imagine is not related to order, rather to
something unique about the first header that is always present, such
as the hostname 'atlantis'.  If this varies, you can still write an RE
to match all possible variations, as long as none of them occur in the
second Received: field.


Tim
_____________________________________________
tmda-users mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-users

Reply via email to