On Thu, 27 Apr 2006, [EMAIL PROTECTED] wrote:

> if ($message_body contains "^HANDLE: *.123$") then
>    save file_123
> elif ($message_body contains "^HANDLE: *.ABC$") then
>    save file_abc
>    finish
> endif

1. You need "matches" rather than "contains" for a regular expression 
match.

2. The newlines in $message_body are replaced by spaces (supposedly to 
make it easy to search for phrases, but that was probably a bad idea). 
So you probably want "\\N\\bHANDLE: .*?123\\b" for your pattern:

  (a) Doubled \\ because it's inside "".
  (b) \N suppresses string expansion which would interpret the following 
      \ characters
  (c) .*? rather than .* for much improved efficiency - it will step
      along one char at a time looking for 123 instead of going to the
      end of the message body and stepping back one char at a time. In
      fact, you would do better with \D* instead of .*
   
Try

  if $message_body matches "\\N\\bHANDLE: [^\\dA-Z]*(123|ABC)\\b" then
    save file_$1
    finish
  endif
  
Untested. Probably won't work exactly like that, but something similar 
will.      

-- 
Philip Hazel            University of Cambridge Computing Service
Get the Exim 4 book:    http://www.uit.co.uk/exim-book

-- 
## List details at http://www.exim.org/mailman/listinfo/exim-users 
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://www.exim.org/eximwiki/

Reply via email to