procmail
[Top] [All Lists]

Re: Filtering capitalized subject

2002-01-09 06:55:42
I would like to filter messages with all capitalized subject.
Can someone point my nose in the right direction ?

Take a look at the 'D' flag in the procmailrc manpage.

One thing you need to consider is just what you mean by an all caps
subject.  The obvious recipe:

  :0 D:
  * ^[Ss][Uu][Bb][Jj][Ee][Cc][Tt]:[A-Z    ]+$
  allcaps

probably isn't right.

Note that '[A-Z   ]' contains one space and one TAB character!

This will catch messages where the subject (with 'Subject:' in any case)
contains only capital letters, spaces and tabs.  You probably want to
allow any punctuation as well as the letters, so the second obvious
recipe might be:

  :0 D:
  * ^[Ss][Uu][Bb][Jj][Ee][Cc][Tt]:[^a-z]+$
  allcaps

which captures any message with a subject containing only characters
that are not lower-case letters.  However that would also catch messages
with a subject like:

  Subject:  33%!!!

which might not be your intention.  Maybe the appropriate thing would be
a recipe that catches messages with a subject that contains no
lower-case letters and at least one upper-case letter?  In which case
something like:

  :0 D:
  * ^[Ss][Uu][Bb][Jj][Ee][Cc][Tt]:[^a-z]*[A-Z][^a-z]*$
  allcaps

should do the job.

Hope that helps,
Martin
-- 
Martin McCarthy                 /</                  PGP key available
    `Procmail Companion'        \>\  http://www.ancient-scotland.co.uk
     Addison Wesley             /</    http://www.ehabitat.demon.co.uk
_______________________________________________
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>