stalwartlabs / sieve

Sieve filter interpreter for Rust
https://docs.rs/sieve-rs/
GNU Affero General Public License v3.0
21 stars 5 forks source link

set doesn't expand regex #8

Closed X-Ryl669 closed 2 months ago

X-Ryl669 commented 4 months ago

Example sieve script:

require ["variables", "envelope", "regex"];
if envelope :regex "to" "alias\.([^.]+)@(.+)$") {
    set "to" "${2}";
    reject "Error ${to}";
}

Expected bob for an envelope.to set to alias.bob@domain. Got {$2} instead

Side note: It works if going through a :replace like set :replace "." "" "to" "{$2}";

X-Ryl669 commented 4 months ago

Linking the other issue here for reference https://github.com/stalwartlabs/mail-server/issues/611

mdecimus commented 2 months ago

This can't be reproduced, see this commit.