--- /dev/null
+Return-Path: <notmuch@kismala.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 088A7431FAF\r
+ for <notmuch@notmuchmail.org>; Wed, 13 Mar 2013 12:16:33 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id uJDV1adWTEmp for <notmuch@notmuchmail.org>;\r
+ Wed, 13 Mar 2013 12:16:31 -0700 (PDT)\r
+Received: from imarko.xen.prgmr.com (imarko.xen.prgmr.com [72.13.95.244])\r
+ by olra.theworths.org (Postfix) with ESMTP id B7483431FAE\r
+ for <notmuch@notmuchmail.org>; Wed, 13 Mar 2013 12:16:31 -0700 (PDT)\r
+Received: from localhost ([127.0.0.1] helo=zsu.kismala.com)\r
+ by imarko.xen.prgmr.com with esmtp (Exim 4.80.1)\r
+ (envelope-from <notmuch@kismala.com>)\r
+ id 1UFrA5-0002Ja-UQ; Wed, 13 Mar 2013 12:16:30 -0700\r
+From: Istvan Marko <notmuch@kismala.com>\r
+To: Guyzmo <guyzmo+notmuch@m0g.net>, Notmuch <notmuch@notmuchmail.org>\r
+Subject: Re: Procmail regex group reuse\r
+In-Reply-To: <20130313151630.GE14028@vilya.m0g.net>\r
+References: <20130313151630.GE14028@vilya.m0g.net>\r
+User-Agent: Notmuch/0.15.2+47~g6daee9b (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+Date: Wed, 13 Mar 2013 12:16:29 -0700\r
+Message-ID: <m31ubjrtyq.fsf@zsu.kismala.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 13 Mar 2013 19:16:33 -0000\r
+\r
+Guyzmo <guyzmo+notmuch@m0g.net> writes:\r
+\r
+> Would it be possible to reuse a part of the match regexp in procmail\r
+> so it can be reused in the action part of the rule. \r
+\r
+procmail has a limited way of extracting subexpressions:\r
+\r
+ MATCH This variable is assigned to by procmail whenever it is\r
+ told to extract text from a matching regular expression.\r
+ It will contain all text matching the regular expression\r
+ past the `\/' token.\r
+\r
+So you get everything between \/ to the end of the whole regexp. In your\r
+case this will get hairy because you need to match stuff after the part\r
+you want to extract. The ?? construct might help to further trim it\r
+down, maybe something like:\r
+\r
+* ^TO\/foo\+[a-z]+@mydomain\.tld\r
+* MATCH ?? ^foo\+\/[a-z]+\r
+{\r
+ TAG=$MATCH\r
+}\r
+\r
+Or if you are willing to switch to maildrop it has pcre and proper\r
+submatches.\r
+\r
+Are you tagging with notmuch-deliver?\r
+\r
+-- \r
+ Istvan\r