Hi,
I just took a short look at the latest draft of the Sieve regex
extension. I noticed that the interactions with the variables extension
are specified more explicitly and a set modifier is added. That's very
good. However, I have a few comments on this.
- Current text in section 7.2 of the draft refers to a variable being
used as `a parameter to :regex' (3rd paragraph), which is not entirely
correct since the :regex match type argument has no actual parameters of
its own. I guess `the regular expression provided in the key string
argument of the involved test command' is meant instead.
An alternative wording for the 3rd paragraph of section 7.2 could be:
"
The :quoteregex modifier is useful when the assigned variable is to be
expanded in a regular expression string, i.e. the key(-list) argument of
a test command using the :regex match type. This modifier adds the
necessary quoting to ensure that the assigned text will only match its
literal occurrence when the variable is later expanded in a regular
expression. Every character with special meaning (".", "*", "?", etc.)
is prefixed with "\" in the expansion. This modifier has a precedence
value of 20 when used with other modifiers.
"
- An example of constructing a regular expression from the contents of
variables would be nice, also to provide an example of how the new set
modifier can be applied. E.g.:
require ["regex", "variables", "subaddress", "envelope", "fileinto",
"copy"];
# Fetch recipient domain
if envelope :domain :matches "to" "*" {
set :quoteregex "domain" "${1}";
}
# Infer the host name of the final receiving server from the 'received'
# headers.
if header :regex "received" ".*by (.*${domain}) .+ for
<?(_dot_)+(_at_)${domain}>?" {
# File a copy on a per-accepting-server basis
fileinto :copy "incoming.${1}";
}
I must say that I'm not at all happy with my example. I would like to
see an example that is actually practically useful, reliable and not
hard to grasp. :) But I am fresh out of ideas...
Regards,
Stephan.
_______________________________________________
sieve mailing list
sieve(_at_)ietf(_dot_)org
https://www.ietf.org/mailman/listinfo/sieve