procmail
[Top] [All Lists]

Re: Problem with regex and backreferences

2002-01-06 18:42:14

What I want to do is to catch all emails coming in to

subscribe-(.*)@domain.com

In procmail you'd write that like this:

subscribe-(_dot_)*(_at_)domain\(_dot_)com

(the regex is closer to egrep than anything else, but it is unique to itself)

forwarded to subscribe(_at_)domain(_dot_)com with the regex match in the 
subject.

It's called $MATCH in procmail.

See man procmailrc and man procmailex 

I think it would be something like

* ^TO_subscribe-\/@domain\.com

Actualkly I'm not sure how you'd get MATCH to equal the .* part w/o the 
@domain.com part, but I'm sure it's possible.  Hopefully someone else will 
chime in.

Now do you want to RETAIN the OLD Subject: line or not?

Assuming YES, then you would just put a line like this ABOVE your recipe:

SUBJECT=`formail -xSubject:`

and then do

:0
* ^TO_subscribe-\/@domain\.com
{
    SUBJECT=`echo $MATCH $SUBJECT`


}

which would prepend $MATCH before the old Subject:
 


Can anyone point me in the right direction?

This is an untested start.... hopefully someone else will pick up and fill in 
what I've said as I'm still a procmail neophyte despite having used it for 6 
years now (boy is *that* sad!)

TjL


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