procmail
[Top] [All Lists]

Re: regex syntax question

2004-03-02 17:28:31
Toen ik David W. Tamkin kietelde, kwam er dit uit:
Ruud:

But if you want to find a word throughout the whole message:
  :0
  * HB ?? \<some-word\>
  some-action

The condition should be
   * HB ?? ()\<some-word\>

or (not necessarily less expensive)
  :0
  * 9876543210^0  ^Subject:.*\<some-word\>
  * 9876543210^0  B ?? \<some-word\>
  some-action

The second condition should be
   * 9876543210^0  B ?? ()\<some-word\>

OK, thanks. 

I don't want to do checks on body-contents at all, I have 
always considered that as a no-go area.

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.

-- 
Affijn, Ruud

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