procmail
[Top] [All Lists]

Re: Grouping filter conditions

1996-10-27 07:54:20
On Sat, 26 Oct 1996 03:56:40 -0500, Philip Guenther 
<guenther(_at_)gac(_dot_)edu>
wrote:
ariel(_at_)best(_dot_)com (Catherine Hampton) writes:
:0
* (From:|Reply-To:|Message-ID:|Path:)|\
(.*moneyworld\.com|\
.*cyberpromo\.com)
Zach Babayco has already pointed the lack of a anchor on the beginning
<...>
will always match.  Removing the spurious '|' and adding a '^' anchor
should fix things up, as shown in Zach's version.

Another thing you might want to check for, at least as a matter of
principle, is that you're not matching on addresses which just happen
to contain "cyberpromo.com" as part of something else. I don't know,
maybe somebody could happen to want to register a domain with the name
anti-cyberpromo.com?

:0
* 
^(From|Reply-To|Message-Id|Path):(_dot_)*[(_at_)(_dot_)](moneyworld|cyberpromo)\.com\>
/dev/null

Here, I'm checking that the part just before "moneyworld" or
"cyberpromo" is either a dot or an @, and that there is whitespace or
something immediately after the "com". 
  (The dot is not magical, and thus doesn't need a backslash, inside a
[] character class. The \> actually stands for word boundary; check
the manual for details. [Procmail gurus: Seems to me like this is less
general than egrep's notion of a word boundary?])
  I would also imagine that minimizing the number of wildcards and
duplications will make the regular expression slightly more efficient
(at the cost of some readability).

Hope this helps,

/* era */

-- 
See <http://www.ling.helsinki.fi/~reriksso/> for mantra, disclaimer, etc.
* If you enjoy getting spam, I'd appreciate it if you'd register yourself
  at the following URL:  <http://www.ling.helsinki.fi/~reriksso/spam.html>

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