procmail
[Top] [All Lists]

stripping MATCH's right hand side

2001-12-07 10:27:09

I'm probably missing something simple, but I can't figure out how to
strip arbitrary text off the end of a variable.

The following recipe works perfectly:

        :0:
        * ^Sender: owner-freebsd-\/(_dot_)*(_at_)FreeBSD(_dot_)ORG
        * MATCH ?? ^\/[^(_at_)]+
        freebsd-$MATCH

because the line with ?? grabs characters up to the "@".  But the same
thing for another collection of lists:

        :0:
        * 
^List-Unsubscribe:.*leave-isp-\/(_dot_)*(_at_)(_dot_)*isp-lists(_dot_)com
        * MATCH ?? ^\/[^(_at_)]+
        isp-$MATCH

does not, because the isp- lists have extra goop after the list name.
I can *identify* their lists reliably enough with /^List-Unsubscribe:/,
but the header lines I'm analysing actually look like:

  List-Unsubscribe: 
<mailto:leave-isp-colo-762587K(_at_)lists(_dot_)isp-lists(_dot_)com>
  List-Unsubscribe: 
<mailto:leave-isp-webhosting-762586E(_at_)lists(_dot_)isp-lists(_dot_)com>
  List-Unsubscribe: 
<mailto:leave-isp-equipment-458649T(_at_)lists(_dot_)isp-lists(_dot_)com>

I could use a recipe that assumed all list names were strings that
terminated at the next hyphen, but I'd much rather just strip out the
/-[0-9]+[A-Z](_at_)(_dot_)*/ and leave it at that.  But how do I do it?  Added 
to
the recipe above, I could use:

        * MATCH ?? ^\/[a-z0-9]+

but I'd rather not, for fear of killing listnames that include other
characters (esp. hyphens), but:

        * MATCH ?? ^\/[^(-[0-9]+[A-Z])]+

looks very awkward to me.  What's right?

Thanks.  ;)


-- 
  Paul Chvostek                                             
<paul(_at_)it(_dot_)ca>
  Operations / Development / Abuse / Whatever       vox: +1 416 598-0000
  IT Canada                                            http://www.it.ca/

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