javascript regular expression validation for domain name?
<p>how to check a valid domain name and username with regular expression in javascript?</p>

<pre><code>-&lt;script&gt;
function validate()
{
 var patt1=new RegExp(/^[a-zA-Z0-9._-]+\\[a-zA-Z0-9.-]$/);

   var text= document.getElementById('text1').value;

  alert(patt1.test(text));

}
</code></pre>

<p>but it does not work for me.</p>
