procmail
[Top] [All Lists]

Re: \/ and whitespace

2006-02-28 13:35:49
On Tue, 28 Feb 2006, 00:15 GMT+01 Ruud H.G. van Tol wrote:

Robert Allerstorfer schreef:
Ruud H.G. van Tol wrote:
Robert Allerstorfer schreef:

  * $ ^to:[$WS]+\/.+

That is not a good way to do it. Because \/ is "greedy to the left",
the "[$WS]+" is equivalent to just "[$WS]", so you can end up with a
$MATCH that starts with whitespace. (And if there would be no
whitespace following the colon, $MATCH would not be changed.)

This is what everybody else uses:

   * $ ^To:.*\/[^$WS].*

thank you, right, I will be sure to use that instead for now on. I am
just wondering why

* $ ^To:.*\/[^$WS].+

won't work.

To: x

OK, sure, that won't work if the To: headerfield consists of only one
single character. I think my preferred form for now on wil be

* $ ^to:[$WS]*\/[^$WS].*

because it is more clear to understand what it does. The first dot in
your suggestion can only stand for whitespace, so I use '[$WS]' rather
than '.'. And, if a regex should match case insensitive (like here)
using all-lowercase characters makes more sense for me. Just my
personal taste.

best,
rob.


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail