conjunction of test function result in Javascript
<p>I have this code:</p>

<pre><code>    RegexpRule=/[A-Za-z_0-9\-]+/g;
   if (RegexpRule.test("ciao")) 
    alert(true);
   else
    alert(false);
</code></pre>

<p>It returns true.
But if I write:</p>

<pre><code>    RegexpRule=/[A-Za-z_0-9\-]+/g;
   if ((RegexpRule.test("ciao")) &amp;&amp; (RegexpRule.test("ciao")))
    alert(true);
   else
    alert(false);
</code></pre>

<p>It returns false.
My real need is this one:</p>

<pre><code>    if (!((RegexpRule.test(login.value)) &amp;&amp; (RegexpRule.test(pswd.value))))
</code></pre>

<p>This if statement functions with a lot of logins and passwords but not with login and password equals to "ciao". So I can't test login and password in only one if statement because of it.</p>

<p>For now I'll do the same thing dividing it in more if statements, but I'd like to Know if someone can make it in only one if statement.
Thanks for the attention.</p>
