 <pre><code>function check(mail) { return !mail.match(/^\.|\.$/); } check('amshaegar@example.org'); // true check('amshaegar@example.org.'); // false check('.amshaegar@example.org'); // false </code></pre> <p>The function check expects a mail address as a String and checks if there is <strong>no</strong> dot(.) at the beginning or end.</p> <p>For detecting multiple dots(...) as well your function would look like this:</p> <pre><code>function check(mail) { return !mail.match(/^\.|\.{2,}|\.$/); } </code></pre>