On 7 Feb 2005 Ruud H.G. van Tol (rvtol(_at_)isolution(_dot_)nl) wrote:
The wrong form is:
because in there, name-1 equals '^From:.*cmathew'.
Good explanation Ruud. Another way to think about this precedence
stuff is to think about good old multiplication and addition in
arithmetic. If you have an expression like this:
there are lots of ways it could be parsed, but the convention is
that multiplication takes precedence over addition, so this
expression should be parsed like this:
But note that the parentheses are not needed in this case. The
only time that parens are needed is if you are doing something
other than the default.
Birl's regular expression was this:
which is equivalent to this:
because "multiplication" takes precedence over "addition"
And these two are equivalent to this:
Again because "multiplication" takes precedence over "addition."
Parens are not needed in any of these three expressions. And they
EITHER the expression
OR the expression
When you want to use a non-default precedence, that's when you
need parens, for example in the arithmetic expression above, you
could say this:
and this is essentially equivalent to what Birl wants:
I think that the confusion might be because '.*' looks like an
operator that might have a lower precedence than '|', but in fact
it is simply a STRING. If we write it this way:
I think it is more clear why we need parens and where we need
(ex Math teacher)
Infinite Ink: <http://www.ii.com/>
Procmail Quick Start: <http://www.ii.com/internet/robots/procmail/qs/>
procmail mailing list Procmail homepage: http://www.procmail.org/