title: Valid domain name regex
body: <p>how should be valid domain name regex which full fill following criteria.</p>
  
  <ol>
  <li>each label max 63 characters long minimum 1 characters</li>
  <li>contains numbers, letters and '-', But</li>
  <li>should not start and end with '-'</li>
  <li>max domain name length 255 characters minimum 1.</li>
  </ol>
  
  <p>for example</p>
  
  <p>some of valid combinations:</p>
  
  <pre><code>a
  a.com
  aa-bb.b
  </code></pre>
  
  <p>I created this <code>^(([a-z0-9]){1,63}\.?){1,255}$</code></p>
  
  <p>But currently its not validating '-' part as required (it's , missing)</p>
  
  <p>Is there any way? </p>
  
  <p>plz correct me if I am wrong.</p>