5 messages in net.sourceforge.lists.courier-maildrop[maildropl] Req for help adding heade...
FromSent OnAttachments
Doc WalkerFeb 7, 2005 7:56 pm 
denis moellerFeb 8, 2005 12:28 am 
Sam VarshavchikFeb 8, 2005 4:19 am 
Doc WalkerFeb 9, 2005 10:52 am 
Sam VarshavchikFeb 9, 2005 4:07 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[maildropl] Req for help adding header with $MATCH pattern containing single quoteActions...
From:Doc Walker (rx-c@wvfans.net)
Date:Feb 7, 2005 7:56:09 pm
List:net.sourceforge.lists.courier-maildrop

The following is one of the criteria in my .mailfilter:

# File Courier-Maildrop mailing list messages: if (/^List-ID:.*courier-maildrop/) { xfilter "${REFORMAIL} -A 'X-WVFans-Mailfilter: 0x0301'" MATCH=escape(${MATCH}) xfilter "${REFORMAIL} -A 'X-WVFans-Match: ${MATCH}'" to "$DEFAULT/.Doc.WVFans_net.Courier-Maildrop.Inbox" }

I add a header to mail delivered with Maildrop indicating which rule was used to move the file, in this case #0x0301, as well as the regular expression that satisfied the criteria. I'm running into an error with the mail received from the Maildrop mailing list because the $MATCH expression contains a single apostrophe (') in the regular expression. I get the following error in my mail.log:

unexpected EOF while looking for matching `''

It appears that $MATCH is replaced with the actual expression as the .mailfilter is parsed and the single quote is not matched, giving the above error.

How do I work around this? I've tried various combinations of quotes, braces, and brackets, but with no success. I realize that I can change my regexp criteria, knowing that the single quote will cause my header addition to fail, but I would like to learn more how I can safely add text headers to an email message. I believe this is one of the purposes of the escape() function.

Rx