On 27 Oct 2018, at 18.35, Max Rydahl Andersen wrote:


Is there a way via the address pattern to state .*@example\.com is good, except [email protected] and [email protected] ?

If you can describe it with a regular expression, then you can put it in. For example, you might be able to do something along the lines of:

    .*(?<!dad|wife)@example\.com

For people not used to regular expressions, this uses so-called negative lookbehind (if you want to google it). It is also possible to use negative lookahead:

        (?!(dad|wife)@).*@example\.com

That is (perhaps) a bit easier to read in this case. (I have not tested it.)

mailmate uses PCRE-like syntax for its regular expression, right ? then regextester.com is a nice tool for testing.

Then yours seems faulty: https://www.regextester.com/?fam=105641 (still matches dad and wife).

but Davids (https://www.regextester.com/?fam=105642) seems more precise (and actually seem to work for me in mailmate)

Benny’s should actually be more precise — mine is vulnerable to matching things that you might not want to exclude (e.g. it wouldn’t just match [email protected], but also [email protected] or [email protected]).

But I would have thought Benny’s needs anchoring at the start of the address in order to work as desired; maybe this is a difference with the specific regular expression engine used in MailMate, but if you do something like:

    ^(?!(dad|wife)@).*@example\.com

…then I would expect it to work (and only filter out the specific addresses listed in the bracketed part at the beginning).


In any case thanks for both answers - it worked ;)

That’s the main thing — happy to help! :-)

David
_______________________________________________
mailmate mailing list
[email protected]
https://lists.freron.com/listinfo/mailmate

Reply via email to