Sieve regex error "invalid preceding regular expression"
Hi, everyone!
I'm trying to get the detail part of the address (i.e. anything that comes between + and @ in the address of this type: alias+detail@mydomain.tld) in this sieve:
if address :regex :localpart "to" "\+(.*)" { fileinto :create "${1}"; stop; }
However, when I try to compile it with sievec, I get this error:
error: invalid regular expression '+(.*)' for regex match: invalid preceding regular expression.
Why is that? Shouldn't I escape the plus sign? Itried also not escaping it, but I get the same error.
(A note why I don't use "envelope :detail" for that purpose: because the detail part of the address is not preserved in the "Envelope-To" after the message is redirected from alias to user. After that redirection the "Envelope-To" contain only user@mydomain.tld, not user+detail@mydomain.tld.)
-- Respectfully, Denis Shadrin
On 19/02/2021 07:54 ml@shadrinden.ru wrote:
Hi, everyone!
I'm trying to get the detail part of the address (i.e. anything that comes between + and @ in the address of this type: alias+detail@mydomain.tld) in this sieve:
if address :regex :localpart "to" "\+(.*)" { fileinto :create "${1}"; stop; }
However, when I try to compile it with sievec, I get this error:
error: invalid regular expression '+(.*)' for regex match: invalid preceding regular expression.
Why is that? Shouldn't I escape the plus sign? Itried also not escaping it, but I get the same error.
(A note why I don't use "envelope :detail" for that purpose: because the detail part of the address is not preserved in the "Envelope-To" after the message is redirected from alias to user. After that redirection the "Envelope-To" contain only user@mydomain.tld, not user+detail@mydomain.tld.)
-- Respectfully, Denis Shadrin
Try '+'
Regards, Aki
On Fri, 19 Feb 2021 08:46:49 +0200 (EET) Aki Tuomi aki.tuomi@open-xchange.com wrote:
On 19/02/2021 07:54 ml@shadrinden.ru wrote:
if address :regex :localpart "to" "\+(.*)" { fileinto :create "${1}"; stop; }
error: invalid regular expression '+(.*)' for regex match: invalid preceding regular expression.
Try '+'
Regards, Aki
Thanks, that did it!
-- Respectfully, Denis Shadrin
participants (2)
-
Aki Tuomi
-
ml@shadrinden.ru