Procmail regex group reuse
Istvan Marko
notmuch at kismala.com
Wed Mar 13 12:16:29 PDT 2013
Guyzmo <guyzmo+notmuch at 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]+ at 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
More information about the notmuch
mailing list