procmail
[Top] [All Lists]

Re: Ending variable necessary?

2002-12-09 11:05:55
On Mon, Dec 09, 2002 at 12:01:32PM -0500, Jefferis Peterson wrote:
Is this correct:

:0 
* ^From.*3DBook.*
/dev/null


Assuming I want to capture all the spam from 
3DBooks2003(_at_)yahoo(_dot_)uk(_dot_)com

Is it necessary to ad the .* at the end of the recipe? Or  Does it do any
harm?

It is not necessary: it is implicitly matched that way. The only time
you need a .* is if you want to match something after it (like you do
in your ^From.*3DBook). Let's walk through it:

*                  start a condition
  ^                match beginning of line
   From            followed by the word 'From'
       .*          followed by anything
         3DBook    followed by '3DBook'
               .*  followed by anything

Whether the last .* is there or not makes no difference, unless you're
using the match operator (\/) to capture something.

The only harm done is a couple of wasted cycles in the regex engine
and a little bit of clutter in your file. No big deal unless you're
needing high performance matching or are a clean-freak.

Scott
-- 
Scott Wiersdorf
scott(_at_)perlcode(_dot_)org

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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