unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Istvan Marko <notmuch@kismala.com>
To: Guyzmo <guyzmo+notmuch@m0g.net>, Notmuch <notmuch@notmuchmail.org>
Subject: Re: Procmail regex group reuse
Date: Wed, 13 Mar 2013 12:16:29 -0700	[thread overview]
Message-ID: <m31ubjrtyq.fsf@zsu.kismala.com> (raw)
In-Reply-To: <20130313151630.GE14028@vilya.m0g.net>

Guyzmo <guyzmo+notmuch@m0g.net> 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

  reply	other threads:[~2013-03-13 19:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-13 15:16 Procmail regex group reuse Guyzmo
2013-03-13 19:16 ` Istvan Marko [this message]
2013-03-13 22:09   ` guyzmo+notmuch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m31ubjrtyq.fsf@zsu.kismala.com \
    --to=notmuch@kismala.com \
    --cc=guyzmo+notmuch@m0g.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).