Hi Michael,

Michael Kjörling (2026/03/29 19:15 +0000):
> On 29 Mar 2026 14:29 +0200, from [email protected] (Sébastien 
> Hinderer):
> >>> save-hook '~f amazon.fr' '=amazon/'
> >>
> >> Also notice in the example how "." is backslashed, because that matches any
> >> character.
> >
> > I indeed didn't pay attention so far. I think I was under the wrong
> > impression that, because the pattern is between single quotes, . is
> > taken litteraly.
>
> If you want a literal match, use =f instead of ~f in the condition. As
> already noted, Mutt configuration file quoting is not the same as
> shell quoting.

Oh, another thing I was not aware of (speaking about the = sign),
thanks!

> The = signals literal matching whereas the ~ signals regular
> expression matching. (You can combine the two in a single matching
> pattern; it's valid to do e.g. "=f @amazon.fr !~f 's[eé]bastien'".) In
> case of for example flags filters there's no difference (~N and =N
> will do exactly the same thing), but for string matching, the
> difference is significant. Especially if you're using IMAP remote
> mailboxes, doing a coarse match using literal matching followed by a
> more fine-grained match using regular expressions probably can improve
> performance (since Mutt can offload some literal matching to the
> server).
>
> See http://mutt.org/doc/manual/#patterns-modifier starting at "You can
> force Mutt to treat EXPR as a simple string" above example 4.1.

I see! Thanks a lot for the in-depth and insightful explanations!


Seb.

Reply via email to