Discussion:
[MlMt] exclude emails in address pattern ?
Max Rydahl Andersen
2018-10-16 10:07:19 UTC
Permalink
Hi,

I got a catch-all domain i.e @example.com
and thus I have address pattern set to `.*@example\.com` as illustrated
in
https://blog.freron.com/2013/handling-multiple-identities/

But I also have some aliases/forwards that aren't really mine for family
members,
lets say ***@example.com, ***@example.com, etc.

Those emails I really don't want to count as "me".

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

Thanks,
/max
http://about.me/maxandersen
David Shepherdson
2018-10-16 11:10:38 UTC
Permalink
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

David
Benny Kjær Nielsen
2018-10-24 11:54:39 UTC
Permalink
Post by David Shepherdson
If you can describe it with a regular expression, then you can put it
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.)
--
Benny
https://freron.com/become_a_mailmate_patron/
Max Rydahl Andersen
2018-10-27 07:35:01 UTC
Permalink
Post by Benny Kjær Nielsen
Post by David Shepherdson
If you can describe it with a regular expression, then you can put it
For people not used to regular expressions, this uses so-called
negative lookbehind (if you want to google it). It is also possible to
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)

In any case thanks for both answers - it worked ;)
/max
Benny Kjær Nielsen
2018-10-28 10:28:32 UTC
Permalink
Post by Max Rydahl Andersen
Post by Benny Kjær Nielsen
For people not used to regular expressions, this uses so-called
negative lookbehind (if you want to google it). It is also possible
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.
Not that it matters for you, but I'm pretty sure it works. MailMate uses
[oniguruma](https://github.com/kkos/oniguruma/blob/master/doc/RE) which
includes negative look-ahead.
--
Benny
https://freron.com/become_a_mailmate_patron/
David Shepherdson
2018-11-01 11:16:23 UTC
Permalink
Post by Max Rydahl Andersen
Post by Benny Kjær Nielsen
Post by David Shepherdson
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
For people not used to regular expressions, this uses so-called
negative lookbehind (if you want to google it). It is also possible
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 ***@example.com, but also ***@example.com or
***@example.com).

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).
Post by Max Rydahl Andersen
In any case thanks for both answers - it worked ;)
That’s the main thing — happy to help! :-)

David
Benny Kjær Nielsen
2018-11-05 15:05:50 UTC
Permalink
Post by David Shepherdson
But I would have thought Benny’s needs anchoring at the start of the
address in order to work as desired;
Actually, MailMate automatically adds anchoring to the address pattern
(`^...$`).
--
Benny
https://freron.com/become_a_mailmate_patron/
Loading...