Understanding matches in sieve

@lbutlr kremels at kreme.com
Wed Oct 21 21:15:46 EEST 2020


RFC 5229 gives the following example:

if address :matches ["To", "Cc"] ["coyote@**.com",
              "wile@**.com"] {
          # ${0} is the matching address
          # ${1} is always the empty string
          # ${2} is part of the domain name ("ACME.Example")
          fileinto "INBOX.business.${2}"; stop;

And I do not understand why ${1} is always the empty string.

In this example, ${1} is the part before the < so using ${2} makes sense.

 if header :matches "List-ID" "*<*@*" {
          fileinto "INBOX.lists.${2}"; stop;
      }

I am laso not sure why the first example used **.com instead of *.com (or is that the reason $1 doesn't contain anything because it is the first * of **?).

If so, my familiarity with the bash syntax for ** may have been my undoing.

If I had

# Given to kremels at kreme.com
if address :matches ["To", "Cc"] ["*@*.*"]
   # ${1} would contain "kremels"
   # ${2} would contain "kreme"
   # ${3} would contain "com"

Yes?


-- 
"Are you pondering what I'm pondering?"
"Sure, Brain, but how are we going to find chaps our size?"



More information about the dovecot mailing list