On Wed, Oct 13, 2004 at 09:58:58AM -0500, David W. Tamkin wrote:
Dallman Ross wrote:
* ^Subject:(.*\<)?\/.+
You realize, Dallman, that so long as there is a match in the head to
^Subject:.
(where the period means "anything except a newline" and not necessarily
a literal period), the
(.*\<)?
will be matched to null, don't you?
I do know it. I not only know it, I am counting on it.
Here is a recipe:
:0
* ^Subject:(.*\<)?\/.+
{ SUBJECT = $MATCH }
Here is the Subject-line of my test message. There is nothing (no whitespace)
following the "A" below.
Subject:A
Here is my verbose log running that message against that recipe:
procmail: Matched "A"
procmail: Match on "^Subject:(.*\<)?\/.+"
procmail: Assigning "SUBJECT=A"
Also, I should point out that I adopted that "(.*\<)?\/.+" syntax from
you after you posted it about two-and-a-half or three years ago. It's
very useful. As you know, it works here because to the left
of the match token, procmail is stingy in its matching; yet to the
right of the match token, it's greedy. And that's why in this case
the "(.*\<)? equates to nothing at all. (What we want it to do.)
Oh, it finally just dawned on me why you interjected the little caveat.
I think it's because before I had suggested code collecting the (usual)
whitespace following the colon in Subject:. I (lazily) expected it
to be there and so just collected it in my match, then expressed
the formail rewrite as:
formail -I "Subject:$TAG%$MATCH"
expecting a space in most cases between the two vars in the printed result.
However, in the improved code I suggested most recently as a replacement,
I changed that rewrite to:
formail -I 'Subject:$TAG $H_SUBJECT"
with a space between the vars, quite on purpose. On purpose, because I
knew what you stated, and counted on it. :-)
Returning to the topic of collecting the Subject in a var, (as David
knows) the above won't work for multi-line subjects; it will just match
the first line. However, I would be startled to find even one message
a year of a multi-line Subject that wasn't spam. So I don't care to
go out of my way to code for it.
--
dman
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail