Toen wij Dallman Ross kietelden, kwam er dit uit:
Ruud H.G. van Tol:
If you also want to POP easily from G_WASHERE,
POP? I don't follow you now.
The G_WASHERE = "${G_WASHERE}${G_LEVEL}:${RCSIG}$NL"
is a PUSH, so G_WASHERE is a stack.
Cutting something from the right of a string with procmail
(the POP) is just doable when you can cut at a unique
substring, in this case <newline><level><colon>.
:0D # TEST (is top of stack)
* G_WASHERE ?? ^[A-Za-z]:\/${TESTSIG}$^^
{ JUSTWASTHERE = $MATCH }
:0D # TEST (is in stack)
* G_WASHERE ?? ^[A-Za-z]:\/${TESTSIG}$
{ EVERWASTHERE = $MATCH }
:0D # POP (remove top of stack, maybe more)
*$ G_WASHERE ?? ^^\/(.+$)*${G_LEVEL}:
* MATCH ?? ^^\/.+(^.+)*
{ G_WASHERE = $MATCH }
Some things are easier when you PUSH up front, like
G_WASHERE = "${G_LEVEL}:${RCSIG}$NL${G_WASHERE}"
because then a POP goes like
:0 # POP (remove top of stack)
*$ G_WASHERE ?? ^${G_LEVEL}:.*$\/([A-Za-z]:.*$)*^^
{ G_WASHERE = $MATCH }
That is even without the risk that you cut too much, when several
strings of the same level were erroneously there. You still can do
*$ G_WASHERE ?? ^\/([^$G_LEVEL]:.*$)*^^
to only keep everything from before the current G_LEVEL.
(all directly from my brain to my fingers to this
list, so utterly untested)
--
Grtz, Ruud
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail