title: Email Subdomains cannot start or end with a hyphen, nor have two in a row
body: <p>I have a situation in which email domain need to pass below scenarios</p>
  
  <p>Domain:</p>
  
  <ul>
  <li>Domain can be made up by subdomains separated by a period.</li>
  <li>Each subdomain must have at least 2 characters.</li>
  <li>Subdomains can be alphanumeric and can include hyphens.</li>
  <li>Subdomains cannot start or end with a hyphen, nor have two in a row.</li>
  </ul>
  
  <p>Not Accepted subdomain</p>
  
  <ul>
  <li>foobar@-fear.com</li>
  <li>foobar@fear-.com</li>
  <li>foobar@fear.com-</li>
  <li>foobar@fear.co--m</li>
  <li>foobar@f.com</li>
  <li>foobar@fear.c</li>
  </ul>
  
  <p>Accepted</p>
  
  <ul>
  <li>foobar@fea-r.com</li>
  <li>foobar@fear.co-m</li>
  <li>foo-bar@fear.com</li>
  <li>foo----bar@fear.com</li>
  <li>foobar-@fear.com</li>
  </ul>
  
  <p>Example: </p>
  
  <pre><code>Email- foobar@mahi.co.in
  Username - foobar
  Domain - mahi.co.in
  
  
  var emailIdExp = ^[A-Za-z0-9._-]+@([A-Za-z0-9-]+\.)*[A-Za-z0-9-]+\.[A-Za-z0-9-]{2,}$
  </code></pre>