procmail
[Top] [All Lists]

Re: exporting header variables

2000-11-07 11:45:30
Collin Park <collin(_at_)cup(_dot_)hp(_dot_)com> writes:
"David W. Tamkin" wrote:
That wastes a process (and it also leaves leading space intact in the 
subject).  Better,

      :0 # brackets enclose caret, space, tab
      * ^Subject:.*\/[^      ].*
      { SUBJECT=$MATCH }

Good idea.  I would have thought it safer to do...
* ^Subject:[   ]*\/.*$

?  I thought I remembered something about the * op being greedy to the 
left of \/ ?

It's the other way around: * and + are greey on the right hand side of
\/ and minimal on the left.  In David's regexp, the .* will match as
little as possible such that the rest still matches, so the negated
character class will match the first non-whitespace character after the
colon.  In yours, the character class will never match anything,
because the rest of the regexp can always match.



Note that you can trim trailing whitespace as well as leading whitespace
by using the following condition:

        * ^Subject:.*\/[^       ](.*[^  ])?

That requires that match both begins and ends with a non-whitespace
character.  The parens and ? are so that it'll match a subject containing
only one non-whitespace character.


Philip Guenther
_______________________________________________
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>