Alessandro Vesely wrote:
> Bowie Bailey wrote:
> > Lyndon Tiu wrote:
> > 
> > > I wrote a maildroprc:
> > > 
> > > -----------------------------------------
> > > if \
> > > ( \
> > > /^To:.*all.*/ \
> > > && \
> > > ( \
> > > ( /^From:.*user1.*/ ) \
> > > 
> > > > > \
> > > 
> > > ( /^From:.*user2.*/ ) \
> > > ) \
> > > )
> > > {
> > > 
> > > to /mail/junk/Maildir
> > > 
> > > }
> > > -----------------------------------------
> > > 
> > > Now the maildroprc regex above means:
> > > 
> > > If an email is being sent to "all" and is coming from either
> > > "user1" or "user2", treat is as junk. 
> > > 
> > > 
> > > My question is, how do you negate the maildroprc regex? How do you
> > > turn it around so that if the email is NOT from "user1" and NOT
> > > from "user2", then treat it as junk.
> > 
> > 
> > I think it would be this (line-continuation characters and redundant
> > parens removed for readability):
> > 
> >     if
> >     (
> >       /^To:.*all.*/
> >       &&
> >       ! /^From:.*user1.*/
> >       &&
> >       ! /^From:.*user2.*/
> >     )
> 
> That's wrong. The negation of A && B && C is !A || !B || !C.
> Easier changing can be achieved by negating the whole, i.e. !(A && B
> && C), or by using an else clause.

Yes, but that's not what was specified.  The original regex (aside
from the apparent typo in the middle) was:

    A && ( B || C)

And based on my reading of his question, he just wanted to negate the
second part.  So that goes like this:

    A && !( B || C)
        or
    A && !B && !C

-- 
Bowie


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to