Matching regexps

Adam Shostack adam at shostack.org
Wed Feb 26 18:20:30 EET 2020


Hi,

I'm having some trouble with matching.  The regexp in my dovecot.sieve
file should match on email addresses, but does not.

# The code:
if header :matches "From" "<[a-z0-9-]*@[a-z0-9-.]*>" {  set "sender" "${1}"; }
if not execute "grepfrom" ["${sender}"] {
  if envelope :matches "from" "*" {  set "sender" "${1}"; }

This failes to match Tamara Denning <tdenning at cs.utah.edu> when I
check that regexp against that string at regex101.com, it shows a
match, but the log (from sieve-test) shows:

348: header test
 348:   starting `:matches' match with `i;ascii-casemap' comparator:
 348:   extracting `From' headers from message
 348:   matching value `Tamara Denning <tdenning at cs.utah.edu>'
 348:     with key `.*<[a-z0-9-]*@[a-z0-9-.]*>' => 0
 348:   finishing match with result: not matched

I would appreciate advice on why the match is failing, or what I can
change to make it match.

Thank you!

Adam



More information about the dovecot mailing list