procmail
[Top] [All Lists]

Re: If no subject, then take first line of body...

2001-03-27 01:29:31
Timothy Luoma wrote,

| Oh!  I think I figured it out!  (Well, I checked my procmail mailbox
| for other $MATCH examples)
| 
| This seems to do it, at least with my specific conditions (where there
| is only one line and that line starts and ends with ( and )
| respectively and no Subject: line)
| 
| :0
| * ! ^Subject:
| {
|       :0 B
|       * ^\(\/.*[^)]+
|       {
|               :0fhw
|               |formail -I"Subject: $MATCH"
|       }
| }

I don't know why you're so fond of excess nesting, Timothy.  But
additionally, the regexp isn't quite right.

If you want to extract from the character after the leading left parenthesis
up to the first right parenthesis, 

  * ^\(\/[^)]+

If you want to extract everything between the two bordering parentheses, even
if there are medial parentheses, then your regexp will work, but the trailing
plus sign is unnecessary:

 * ^\(\/.*[^)]

because all characters up to the closing right parenthesis will get absorbed
into ".*" anyway.

Since I'm guessing that you want to allow medial parentheses, here:

 :0fwh
 * ! ^Subject:
 * B ?? ^\(\/.*[^)]
 | formail -I"Subject: $MATCH"

I'm not too comfortable with the plan of accepting the text after any flush-
left left parenthesis in the body and if it were my setup I'd allow it only
on the top line; that way it could pick up only items intended as subjects
and not stray text strings.  Accordingly, I'd start the regexp with ^^ in-
stead of just ^.

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