procmail
[Top] [All Lists]

Re: Trouble with multi-line MATCH

2000-02-18 02:16:11
On Fri, 18 Feb 2000 02:59:16 -0600,
Philip Guenther <guenther(_at_)gac(_dot_)edu> wrote:
era eriksson <era(_at_)iki(_dot_)fi> writes:
What I thought he was asking, after thinking the same thing you
apparently thought, was if there could be something less
cumbersome than recursive INCLUDERC=s and all that jive to look
for a multi-condition pattern. If there are many matches, Procmail
will grab the first, but perhaps it is the second one which would
satisfy your additional checks against MATCH. That sort of thing
is what I imagine this is about. (But I haven't really gone back
and looked at the start of this thread. Anyway, if that's not what
Ralph meant, consider this one of +my+ top items for the wish
list.)
Hmm, that sounds like "look ahead assertions", at least for the
case where the additional checks are regexps. Is that what you're
thinking of, era?

Not exactly. More like this.

    :0R
    * ()\/foo|bar|baz|quux
    * $ $\MATCH.*($)\/foo|bar|baz|quux
    * $ $\MATCH.*($)\/foo|bar|baz|quux
    { action }

The R flag here would mean, if the first condition matches but the
second doesn't, roll back and look for the next possible match for the
first condition, then repeat recursively until you run out of matches,
or the conditions are all true.

This particular case could of course be solved with lookahead, but I
believe it shouldn't be hard to come up with cases which can't.
(Think, grep MATCH out of a file, for example.)

/* era */

-- 
 Too much to say to fit into this .signature anyway: <http://www.iki.fi/era/>
  Fight spam in Europe: <http://www.euro.cauce.org/> * Sign the EU petition