procmail
[Top] [All Lists]

Re: Filtering On Multiple IP Partial Address

2001-01-29 01:14:54
At 12:02 PM 1/28/01 -0800, Professional Software Engineering wrote:

* ^Received:.*\[(201\.1[0-9][0-9]|202\.0?9[0-9]|211\.0?7[0-9])\.[0-9]+\.[0-9]+\]

This should match IP octets starting with what you're asking for (and matching the digit counts your example masks represented), while also handling optional leading zeroes on the octets which are only two digits long (0? matches zero or one '0').

Tnx so much, Sean, but doesn't it require a "\" at the end? I'm studying this but think I did not use the best examples, because I think all IP addresses have 4 component parts??? like aaa.bb.cc.dd ... but the bb could be bbb and the cc could be ccc and the dd could be ddd (letters representing the number of digits separated by the "." (periods).

In other words, after the aaa.bbb I think I need to put another set of [0-9] 's in, but in case there is NOT a "0" after the period in the 2nd position (bbb), I'll be "SOL" ... unless you mean that 0? matches "none" rather than "zero" the number???
And, don't I need a ")" before the "(" at the front and the ")" at the back???

So, wouldn't I need something like (except I don't understand the "+" ones at the end:

* ^Received:.*\[(202\.1[0-9]\.[0-9]\.[0-9]|202\.0?9\.[0-9]\.[0-9]|211\.0?7\.[0 -9])\.[0-9]+\.[0-9]+\]

Oh gosh...now I think I'm a bit confused.  I'll try to explain better:

      A.  ([202.1-and-1-or-2 digits.1-or-2-or-3-digits.1-2-or-3-digits])

      B.  ([202.9-and-1-or-2-digits.1-or-2-or-3-digits.1-2-or-3-digits])

      C.  ([211.7-and-1-or-2-digits.1-or-2-or-3-digits.1-2-or-3-digits])

In other words, after the 202.1, 202.9 and 211.7 ....... each respectively, to match WHATEVER follows... regardless of whether the .b.c.d componet portions have 1, 2 or 3 digits involved.

Have I confused you, or better clarified the objective???

Thanks.

Eric




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