title: jQuery / Javascript - Multiple RegEx Validation
body: <p>How would you go about validating 2 different regular expressions in jQuery or JS?</p>
  
  <p>My JS Code:</p>
  
  <pre><code>function validate(){
      var MyField = document.getElementById('MyField');
      if (MyField.value == null || !MyField.value.toString().match(/^(\d{3})-?\d{2}-?\d{4}$/) || !MyField.value.toString().match(/^(\d{2})-?\d{7}$/));
      alert('Ivalid Entry ...'); 
      return false;
  }
  </code></pre>
  
  <p>My HTML:</p>
  
  <pre><code>&lt;form action=""&gt;
    &lt;input id="MyFIeld" name="MyField" type="text" /&gt;
    &lt;input type="submit" value="Submit" onClick="validate();" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Basically its for Tax ID and SSN formatting properly. ##-####### or ###-##-#### ...
  I am open to JS or jQuery solutions...all help much appreciated.</p>