procmail
[Top] [All Lists]

Re: removing suffixes without a shell

1998-06-17 00:00:41
|Tue 98-06-16 dattier(_at_)wwa(_dot_)com (David W. Tamkin) list.procmail
| Jari Aalto's new list recognition routine's documentation includes this:
|
| |         `JA_LIST_USE_SHELL'
| |
| |         This variable controls if shell is called to remove
| |         "-request|-help|-owner" words from list name. Procmail can easily
| |         reduce prefixes:
| |
| |             owner-list-name --> list-name
| |
| |         but it can't easily remove words to the right. This would
| |         require calling shell and command `expr':
| |
| |             list-name-owner --> list-name
|
| Not true; suffixes can be removed without shells or outside programs.
|
| :0
| * LISTNAME ?? -(owner|request|help)^^
| * LISTNAME ?? ^^\/.*-
| * MATCH ?? ^^\/.*[^-]
| { LISTNAME = $MATCH }
|
| That works even if there are embedded hyphens in the list's name; the only
| problem would come from a trailing hyphen in the list's name.

Exellent David! I was using recipe to ditch single hypen names
with recipe below, but forgot that I could use ".*[^-]".
Thanks! No all is handled by procmail, so the new subroutine is
very lightweight for detecting mailing list messages (I get 500 a day)

    :0
    *   LIST   ?? ^^[^-]+-()\/.*
    * ! MATCH  ?? -
    *   LIST   ?? ()\/[^-]+
    {
        LIST = $MATCH
    }

New version v1.10 based on David's suggestion is now out. There is no
shell calls anymore and the subroutine could be slimmed down.

Cheers!
jari


<Prev in Thread] Current Thread [Next in Thread>