Sieve regex error "invalid preceding regular expression"

Aki Tuomi aki.tuomi at open-xchange.com
Fri Feb 19 08:46:49 EET 2021


> On 19/02/2021 07:54 ml at 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 at 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 at mydomain.tld, not user+detail at mydomain.tld.)
> 
> -- 
> Respectfully,
> Denis Shadrin

Try '[+](.*)'

Regards,
Aki


More information about the dovecot mailing list