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