title: Javascript - evaluating multiple regular expressions on one line
body: <p>I'm fairly new to regular expressions in Javascript and I'm trying and failing to do something that seems simple. Basically, I need to evaluate whether a string meets 1 of 2 regular expression conditions. Basically, an input string can have 1 of 2 forms, and either of those is valid and anything else whatsoever is invalid.</p>
  
  <p>So say I have 2 regular expressions: <code>a= ^[0-9]\d{3}$</code> and <code>b= ^1-\d{5}</code> and want to see if an input string matches either before continuing. What I want to do is something like this:</p>
  
  <pre><code>If((!a.test(input)) || (!b.test(input)))
  {
     alert("Invalid ID");
  }
  </code></pre>
  
  <p>I've also tried a variation using the "|" operator:</p>
  
  <pre><code>if((!a|!b.test(input)))
  </code></pre>
  
  <p>But so far nothing has worked. Usually I get the statement to validate 1 or none of them, but never both. I'm not sure what I'm doing wrong here.</p>
  
  <p>Thank you!</p>