procmail
[Top] [All Lists]

Re: quick question

1999-06-10 02:35:43
On Wed, 9 Jun 1999 22:37:37 -0500 (CDT), Jeff 
<schaller(_at_)southwind(_dot_)net>
wrote:
On Wed, 9 Jun 1999, Michael Johnson wrote:
: 0 :
* ^From:(_dot_)foo(_at_)fizz(_dot_)terra(_dot_)net
! eros(_at_)hyancinth(_dot_)org
is it really neccesary to escape the periods in the match line?
Not _really_. It makes for a more precise regular expression.
_Usually_, the dot will match an actual dot, and all will be well.
Backslash dot will match only an actual dot.  It's just being pedantic.
While we're being pedantic, you probably want to say
* ^From:(_dot_)*foo(_at_)fizz(_dot_)terra(_dot_)net
instead of
* ^From:(_dot_)foo(_at_)fizz(_dot_)terra(_dot_)net

This kind of illustrates the point of why you want to [teach people to
always] use backslashed periods -- short words and sweeping
generalizations in general :-) are prone to mismatches; for example,
the above will actually match any address whose localpart ends in foo.
Similarly, if the domain name would have been very short and/or
generic, the risk that an unescaped period would match something
unwanted would be very real.

(_dot_)*foo(_at_)fizz(_dot_)terra(_dot_)net is not very likely to mismatch if 
you don't have
other addresses which end in foo, but think about something like
a(_at_)net(_dot_)com -- you could reasonably expect there to be a large number 
of
other (something)-a addresses at net.com, and domains whose names
accidentally match net.com (net-com.net, netzcom.com,
net.commodore.org) so you would really really want to constrain this.

In this particular case, you should probably write

    * ^From:(.*\<)?foo(_at_)fizz\(_dot_)terra\(_dot_)net\>

or even something still better constrained if you want to be
absolutely 100% sure there will never be any accidental mismatches.
(\< and \> are problematic because they can validly match characters
which can be part of an e-mail address. The above would still match on
bar-foo(_at_)(_dot_)(_dot_)(_dot_) or ...terra.net.org.)

/* era */

-- 
.obBotBait: It shouldn't even matter whether     <http://www.iki.fi/era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>
 * Sign the European spam petition! <http://www.politik-digital.de/spam/en/> *

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