Justin Gombos wrote:
I never heard of this problem! I have been running scripts for years
such that a regex conditional begins with "\".
[such as]
:0
*$ ^TO_$TO_FROM_ML
*$ ^TO_\/$TO_FROM_ML_PREFIX@
* MATCH ?? ()\/[^(_at_)]+
{
...
}
So this recipe should be failing on the second conditional?
No. Its first character that isn't whitespace or a modifier is a caret.
Also, notice the "()" prefix on the third conditional. I was only
copying someone else, and didn't know what the parenthesis were for.
That's why it's there.
So what's really happening in the absense of "()"?
If the first character after any whitespace, $-modifiers, weights, or
"var ??" search area specifications is a backslash, procmail takes it to
mean "end of whitespace" and strips it. So whatever you expected the
backslash to do to the character after it won't happen.
In that particular example,
* MATCH ?? \/[^(_at_)]+
would be read the same as
* MATCH ?? ()/[^(_at_)]+
which is the same as
* MATCH ?? /[^(_at_)]+
and since $MATCH is highly unlikely to include a foreslash, the
condition would fail and procmail would never enter the braces.
Confusingly, this would work:
* MATCH ?? \\/[^(_at_)]+
but it's a pain to read and edit, because when we see two backslashes,
we expect them to represent a literal backslash. If you actually wanted
a regexp representing one literal backslash, you'd need
* \\\
or
* ()\\
It also gets confusing with less-than and greater-than signs.
* <text
is a syntax error for a size condition (since the text is not a number).
* \<text
searches for "<text" but looks funny, because we expect "\<" to
represent a non-word character.
* \\<text
searches for "[non-word character]text" but looks weird as well, because
we expect "\\<" to represent a literal backslash plus a less-than sign.
An empty pair of parentheses is a form that pleases procmail without
looking odd to human brains.
You could also use ".*" or ".?" to defuse a leading backslash or angle
bracket, but "()" is less work for procmail's regexp engine.
____________________________________________________________
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