procmail
[Top] [All Lists]

Regarding Re:'s and Fwd's

2001-06-23 15:40:49
Just thinking ... this is strictly untested:

 prefix="(Re([[(][0-9]+[])]|\^[0-9]+)?|Fwd?|Sv|Aw):[    ]*"

 :0
 * ^Subject:[   ]*\/$prefix($prefix)+.+
 {
  OLDSUBJECT=$MATCH # our workspace

  :0 # save leftmost prefix and its trailing space
  * $ OLDSUBJECT ?? ^^\/$prefix
  { KEPTPREFIX=$MATCH }

  :0 # collect all prefixes and trailing space
  * $ OLDSUBJECT ?? ^^\/($prefix)+
  ( ALLPREFIXES=$MATCH }

  :0fwh # keep leftmost prefix and everything that followed the rightmost one
  * $ OLDSUBJECT ?? ^^$\ALLPREFIXES\/[^         ].*
  | formail -i "Subject: $KEPTPREFIX$MATCH"
  :0Efwh # maybe nothing followed the rightmost, and it was all prefixes?
  | formail -i "Subject: $KEPTPREFIX (no further subject)"
 }

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