A question about procmailrc

Paul Howarth paul at city-fan.org
Fri Feb 3 08:05:01 UTC 2006


On Thu, 2006-02-02 at 14:45 -0600, Hongwei Li wrote:
> > On 2/2/2006 12:10 PM, Hongwei Li wrote:
> >
> > [snip]
> >
> >>
> >> The * is a wild char because there are probably other letters after office,
> >> e.g. . ] or space etc.  I also tried:
> >>
> >> :0:
> >> * ^Subject:.*is out of the office*
> >> $MAILDIR/Trash
> >
> > * is not a wild card character.
> >
> > dot is a wild card character.
> >
> > When dot is followed by splat (.*) that means "zero or more anything"
> >
> > So, the above says match on "subject:' starting in column 1
> > followed by any number of characters (zero or more)
> > followed by "is out of the office*"
> >
> > I'm not certain what that last asterisk does....
> > did you try:
> > * ^subject:.*is out of the office.*
> >
> > note the ".*" at the end, and not just "*"
> >
> > Don
> >
> 
> Why does this work when the subject line has many other chars after FAILURE:
> 
> # block junk mails from msnotes:
> :0:
> * ^Subject:.*DELIVERY FAILURE*
> $MAILDIR/Junk

This regex means "a Subject: header containing zero or more of any
character followed by DELIVERY FAILUR followed by zero or more E
characters". Since the regex does not end with "$" it is not anchored to
the end of the Subject: header and thus any further characters may also
exist at the end of the Subject: header and they will not affect
matching.

> The real subject is something like:
> DELIVERY FAILURE: 550 5.7.1 Message content rejected...
> 
> I didn't use .*, but only * above.

Having a * at the end of the regex is pointless here. It does nothing.

Paul.




More information about the fedora-list mailing list