On Tue, Jun 05, 2007 at 02:35:16AM +0100, Stephen Allen wrote:
In both my procmail recipe files, I define white space, like this:
SPACE = ' '
TAB = ' '
WS = "$SPACE$TAB"
In one recipe files, I use the following condition, which successfully
matches against the mailbox.
* ^X-Original-To:[$WS]*\/[^(_at_)]+
In the other recipe file, I use a similar condition, which won't match
at all.
* ^X-Original-To:[$WS]*help_please(_at_)mydomain\(_dot_)tld
However, it WILL match if instead of using [$WS]* I use
<space><tab><asterisk> instead.
the reason it didn't work is that you forgot the $ expander.
One needs that on condition lines to expand variables.
* $ ^X-Original-To:[$WS]*help_please(_at_)mydomain\(_dot_)tld
The reason the first one works even without that is because of the
nature of the match operator and how it handles regexes. That
masks the fact that the var was not expanded on that line, either.
The below recipe would also work, and to procmail it is equivalent
to what you have above:
* ^X-Original-To:\/[^(_at_)]+
If you look in your logs, though, you will see that you have a space
at the front of the match.
That is because regex matches in procmail in the normal case are
"stingy." Procmail will try to match the least bit (that's an
English word, not a computer term) that it can and still complete
the match request. In this case, matching nothing at all satisfies
the regex (both mine and yours) and works nearly as you intended,
because the start of the match string is, indeed, a non-at-sign in
both cases.
Procmail's match frugality (which saves it effort over the long
run) is reversed to the right of a match token. Otherwise "\/.*"
would expand to nothing. Right of the match token, we call
procmail's regex-match action "greedy."
What you probably want for your condition is this:
* $ ^X-Original-To:.*\/[^(_at_)$WS]+
That will start the match at the first non-whitespace char.
--
dman
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail