procmail
[Top] [All Lists]

Re: Remove string from $MATCH?

2003-02-19 20:11:28
Tyler asked,

| I'm testing on the Sender field for certain mailing lists and
| delivering to the matched word, for example:
| 
| :0 : # Match on Sender field
| * SENDER ?? ()\/(plug-(devel|jobs)|pm-list)-admin@
| * MATCH ?? ()\/[^(_at_)]+
| $MATCH
| 
| where the expected Sender fields would be:
| 
| "plug-devel-admin(_at_)pdxlinux(_dot_)org"
| "plug-jobs-admin(_at_)pdxlinux(_dot_)org"
| "pm-list-admin(_at_)pm(_dot_)org"
| 
| My problem is I want to remove that "-admin" string from the MATCH
| variable, much like the '@' character is being removed.
| ... but I'd like to be able to test for the whole first half of the
| address, while omitting that "-admin" string in MATCH so the folder
| names remain manageable. How is this done?

There is no general answer, but try adding these two conditions:

 * MATCH ?? ^^\/.*-
 * MATCH ?? ^^\/.*[^-]

Those should strip the last hyphen-connected element from $MATCH.



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