procmail
[Top] [All Lists]

Re: Subject-Lookup Questions

1996-03-01 15:13:16
Is there a way to provide exclusion within a single-line recipe?
Say the query specifies "ups" to get messages about power supplies.
Is there a way to exclude messages about "tape backups?"  I know
we have | within the regex, but is there a way to do & as well?

Can someone explain to me why the following regex matches ALL
subjects?

:0 HW
* ^Subject:.*(floating point)|(div(ide)? by (zero)|(0))


First, the parenthesis grouping is wrong:

I'll place each alternative on a separate line to show them more
clearly:  

  Alternative 1:        ^Subject:.*(floating point)
  Alternative 2:      | (div(ide)? by (zero)
  Alternative 3:      | (0))

So, you are matching either a Subject line with the words "floating
point", or any header with the text "div(ide)? by zero", or
any header with the text of "0".

Since almost every piece of mail you get has a header (Date? From?) with
a "0" character in it, it will match almost every time.

It works fine if you change the last part to: ...by (zero|0))

I doubt it.  It would still be broken.

Here are some clues:

* Alternation is only bounded by parenetheses.  Eg:

    ^Subject: A|B

  means "Subject: A" *or* "B", not "Subject: A" or "Subject B".  To
  achieve what it seems you want to do, use:

    ^Subject: (A|B)
 
* A parenthetical expression is not optional, unless it is followed by
  ?  or *.    EG:

    ^Subject:.*(floating point)

  is the same as "^Subject:.*floating point"

The recipe condition I'll bet you would like is:

    * ^Subject:.*(floating point|(div(ide)? by (zero|0)))

Alan

PS: You're welcome.

<Prev in Thread] Current Thread [Next in Thread>