Andrew Edelstein <andrew(_at_)pure-chaos(_dot_)com> writes:
On Thu, Nov 23, 2000 at 12:14:59AM -0600, Philip Guenther wrote:
...
:0
* ^To:[ ]*\/[^ ].*
{
VARIABLE = $MATCH
}
I've also fixed the condition to strip leading whitespace. Both
brackets contain both a space and a tab; the second one starts with a
caret to invert it.
If I follow that correctly, the second bracket (with the carat) causes the
match to start with the first non-whitespace character. Isn't this already
accomplished with the first bracket?
Nope. Procmail's regexp engine is slightly weird: *, +, and ?
operators to the _left_ of the \/ token are not greedy. The obvious
* ^To:[ ]*\/.*
condition therefore doesn't strip the leading whitespace because the
first * prefers to match nothing when it can, and the .* means it can
always do so. The solution is to always force a 'precise' match for
the first character to the right of the \/.
(Actually, it's the other way around: the *, +, and ? are _only_ greedy
to the right of the \/ token. You just can't tell when there's no
extraction taking place.)
Philip Guenther
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail