[Dovecot] sieve and pattern matching

David Newman
Sat, 10 Sep 2011 19:49:39 -0000

Dovecot 1.2.17

What is the sieve syntax for matching text somewhere in a subject line,
but not at the beginning of the line?

Background: Multiple machines each send a message with the subject of
"<hostname> operations run" to a mail server. The
<hostname> value is
different for each sender.

This sieve filter does not match any message:

require
["fileinto","envelope","reject","vacation","imapflags","relational","co
mparator-i;ascii-numeric","regex","notify"];
require ["body", "fileinto",  "regex"];

# currentops reports
if header :contains "Subject" ".* operations run"
{
fileinto "currentops";
stop;
}

However, a similar filter will match if, and only if, the string occurs
at the beginning of the subject line.

The various sieve help pages I've found suggest that pattern matching
anywhere in the subject line should work, not just at the beginning. How
to achieve this?

TIA

dn