procmail
[Top] [All Lists]

Re: regex syntax question

2004-03-10 14:57:55
On Wed, Mar 03, 2004 at 01:21:23AM +0100, Ruud H.G. van Tol wrote:
A check that might be useful is to score the occurance of 
(certain) 8-bit codes in the first lines of the body.

    :0
    * B ?? ^^\/.*$*.*$*.*$*.*$*\
               .*$*.*$*.*$*.*$*\
               .*$*.*$*.*$*.*$*\
               .*$*.*$*.*$*.*$*.*
    { B_chunk = $MATCH }

    :0 D
    *  -1^1 B_chunk ?? .
    *   2^1 B_chunk ?? =[0-7][0-9A-F]
    *  20^1 B_chunk ?? [\x80-\xff]
    *  22^1 B_chunk ?? =[89A-F][0-9A-F]
    suspect

The \xHH's should be replaced by the actual characters. 
Other scoring condition-lines can of course be added.

That regex will trip the 'Exceeded LINEBUF' message, 
now and then. A better way puts at most 1000 bytes 
(for example) of the body into B_chunk.

  MAXINT = 2147483647
  :0
  *      -1000^0
  * $  $MAXINT^0
  *          1^1  B ?? ^^\/(.*$?)*
  { B_chunk = $MATCH }

-- 
dman

_______________________________________________
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>