title: Regular Expression for validating DNS label ( host name)
body: <p>I would like to validate a hostname using only regualr expression. </p>
  
  <p>Host Names (or 'labels' in DNS jargon) were traditionally defined by RFC 952 and RFC 1123 and may be composed of the following valid characters.</p>
  
  <p>List item</p>
  
  <ul>
  <li>A to Z ; upper case characters</li>
  <li>a to z ; lower case characters</li>
  <li>0 to 9 ; numeric characters 0 to 9</li>
  <li>-      ; dash</li>
  </ul>
  
  <p>The rules say:</p>
  
  <ul>
  <li>A host name (label) can start or end with a letter or a number</li>
  <li>A host name (label) MUST NOT start or end with a '-' (dash)</li>
  <li>A host name (label) MUST NOT consist of all numeric values</li>
  <li>A host name (label) can be up to 63 characters</li>
  </ul>
  
  <p>How would you write Regular Expression to validate hostname ? </p>