procmail
[Top] [All Lists]

Deconstruction of FROM_DAEMON

1997-11-07 11:28:45
In an attempt to resolve a ringing mail problem, I inserted
a FROM_DAEMON recipe to try and catch bouncing mail at the
head of my .procmailrc.

I discovered that it "caught" a *lot* of mail I hadn't expected.
I began an attempt to deconstruct the macro in order to understand
what happened. (BTW, it became really obvious what the problem was
as I proceeded).

Most of the RE is pretty to understand, but there are a couple
of bits I need some help with...

I'm having trouble understanding the RE *after* the "From "
but before the "secondary" header field (#1) (Postmaster, 
daemon etc) and the one *after* the secondary header field (#2).

That is I can dope out what the RE *does* but I can't figure
out what it "means" (is trying to accomplish).

Here are the specific REs I'm talking about:

#1

([^>]*[^((_dot_)%(_at_)a-z0-9])?

I translate this to mean an Optional group of characters
consisting of zero or more characters that aren't a ">"
followed by a single character that isn't any of "(.%a-z0-9"

See what I mean?  I can see what it matches but I don't 
understand the intent.

#2

I'm not even going to try to but *that* one into english.

(([^).!:a-z0-9][-_a-z0-9]*)?[%@>\t ][^<)]*(\(.*\).*)?)?$([^>]|$)
                                ^^^
That "\t " sequence *really* has me confused?  Is the "\t" 
sequence supposed to represent a tab?  I thought the procmail 
RE engine didn't support that sort of perlish construction.

I am really working hard to understand regular expressions in 
general but the two above really have me stumped.

Some clues will be gratefully accepted.

adTHANKSvance.

Simeon

PS.  Am I correct in assuming that in a "character class"
(things between "[" and "]") that RE metacharacters *don't*
need to be escaped?

==============================================================

And here is the entire RE (for the context) with my comments):

(^

 (Precedence:.*(junk|bulk|list)
  |To: Multiple recipients of 
  |(((Resent-)?(From|Sender)|X-Envelope-From):
  |>?From )

   ([^>]*[^((_dot_)%(_at_)a-z0-9])?                  

    (Post(ma?(st(e?r)?|n)|office)         Postoffice, Postman, 
                                          Postmast, Postmaster,
                                          Postmster, Postmastr,
Postmstr, Postmast,
                                          Postmn 
     |(send)?Mail(er)?                    sendmailer, sendmail, 
                                          mail, mailer
     |daemon
     |mmdf
     |n?uucp                              nuucp, uucp
     |LIST(SERV|proc)                     LISTSERV, LISTproc
     |NETSERV
     |owner
     |r(e(quest|sponse)|oot)              root, request, response
     |b(ounce|bs\.smtp)                   bounce, bbs.smtp
     |echo
     |mirror 
     |s(erv(ices?|er)|mtp)                server, services, smtp
     |A(dmin(istrator)?|MMGR|utoanswer))  Autoanswer, AMMGR, Admin,
                                          Administrator

     (([^).!:a-z0-9][-_a-z0-9]*)?[%@>\t ][^<)]*(\(.*\).*)?)?$([^>]|$))

)

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