procmail
[Top] [All Lists]

Re[2]: \[ works within [...] but \] doesn't

2003-11-16 03:57:15
On Sat, 15 Nov 2003, 10:29 GMT-08 (19:29 local time) Bart Schaefer
wrote:

That's because backslashes are not special inside procmail [ ] character
classes.  The backslashes that are doing any good there are the ones in
the substring "\\\"\`\$" -- and that's only because the entire thing is
inside double quotes for the assignment.

The only way to quote a ']' within a character class is to place it at the
beginning of the class.  I'm pretty sure the same goes for a hypen as well
-- that is, "[\-\]" is being read as "the range backslash to backslash".

Try:

C = "[-]['/@#_!=,;: \\\"\`\$.*+?^()]"

thanks for pointing me to the right direction. Your suggested
assignment only recognises a hyphen, followed by zero or one
characters of the other characters. I am now using

 C = "[]['/@#_!=,;:.*+?^() \\\"\`\$-]"

and it works fine.

To summarize, the things to be taken care of are:

(1) Within the "[...]" class, the first character must be ] otherwise it
causes the previous character to be the last recognized one! 
(2) The last character must be - (hyphen) otherwise it would act as
range operator
(3) The only characters that must be \ escaped are \"`$ (or are there
any additional ones?)

Finally, here is the recipe I am now successfully using against
several forms of viagra in the subject of spam mails:

:0
* $ ^Subject:.*((v|\\/)$C?(i|1)$C?(a|@)$C?g$C?r$C?(a|o))
$MYSPAM

best,
rob.



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>