<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">On 27 Oct 2018, at 18.35, Max Rydahl Andersen wrote:</p>
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px">
<blockquote style="border-left:2px solid #777; color:#999; margin:0 0 5px; padding-left:5px; border-left-color:#999">
<blockquote style="border-left:2px solid #777; color:#BBB; margin:0 0 5px; padding-left:5px; border-left-color:#BBB">
<blockquote style="border-left:2px solid #777; color:#BBB; margin:0 0 5px; padding-left:5px; border-left-color:#BBB">
<p dir="auto">Is there a way via the address pattern to state .*@example.com is good, except <a href="mailto:dad@example.com" style="color:#BBB">dad@example.com</a> and <a href="mailto:wife@example.com" style="color:#BBB">wife@example.com</a> ?</p>
</blockquote>
<p dir="auto">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:</p>
<pre style="background-color:#F7F7F7; border-radius:5px 5px 5px 5px; margin-left:15px; margin-right:15px; max-width:90vw; overflow-x:auto; padding:5px" bgcolor="#F7F7F7"><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0" bgcolor="#F7F7F7">.*(?<!dad|wife)@example\.com
</code></pre>
</blockquote>
<p dir="auto">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:</p>
<pre style="background-color:#F7F7F7; border-radius:5px 5px 5px 5px; margin-left:15px; margin-right:15px; max-width:90vw; overflow-x:auto; padding:5px" bgcolor="#F7F7F7"><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0" bgcolor="#F7F7F7">(?!(dad|wife)@).*@example\.com
</code></pre>
<p dir="auto">That is (perhaps) a bit easier to read in this case. (I have not tested it.)</p>
</blockquote>
<p dir="auto">mailmate uses PCRE-like syntax for its regular expression, right ? then regextester.com is a nice tool for testing.</p>
<p dir="auto">Then yours seems faulty: <a href="https://www.regextester.com/?fam=105641" style="color:#777">https://www.regextester.com/?fam=105641</a> (still matches dad and wife).</p>
<p dir="auto">but Davids (<a href="https://www.regextester.com/?fam=105642" style="color:#777">https://www.regextester.com/?fam=105642</a>) seems more precise (and actually seem to work for me in mailmate)</p>
</blockquote>
<p dir="auto">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 <a href="mailto:dad@example.com" style="color:#3983C4">dad@example.com</a>, but also <a href="mailto:grandad@example.com" style="color:#3983C4">grandad@example.com</a> or <a href="mailto:trinidad@example.com" style="color:#3983C4">trinidad@example.com</a>).</p>
<p dir="auto">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:</p>
<pre style="background-color:#F7F7F7; border-radius:5px 5px 5px 5px; margin-left:15px; margin-right:15px; max-width:90vw; overflow-x:auto; padding:5px" bgcolor="#F7F7F7"><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0" bgcolor="#F7F7F7">^(?!(dad|wife)@).*@example\.com
</code></pre>
<p dir="auto">…then I would expect it to work (and only filter out the specific addresses listed in the bracketed part at the beginning).</p>
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px">
<p dir="auto">In any case thanks for both answers - it worked ;)</p>
</blockquote>
<p dir="auto">That’s the main thing — happy to help! :-)</p>
<p dir="auto">David</p>
</div>
</div>
</body>
</html>