title: Best way to validate long list of random postal codes
body: <p>I have a long list of postal codes I have to validate.</p>
  
  <p><a href="http://pastebin.com/ZRMgwtR7" rel="nofollow">Link to postal codes</a></p>
  
  <p>As you can see it's quite random there is no real order.</p>
  
  <p>I tried making a switch and put in everything by hand like so:</p>
  
  <pre><code>switch (true) {
                      case ($(this).val().length &lt; 5) :
                          console.log("not filled out");
                          break;
                      case (number &gt;= 1001 &amp;&amp; number &lt;= 6999):
                          validated = true;
                          error = false;
                          break;
                      case (number &gt;= 8001 &amp;&amp; number &lt;= 34999):
                          validated = true;
                          error = false;
                          break;
                      case (number &gt;= 36001 &amp;&amp; number &lt;= 37999):
                          validated = true;
                          error = false;
                          break;
                      default:
                          console.log("error");
                          error = true;
                  }
  </code></pre>
  
  <p>But I quickly realised this would be a stupid long code. 
  What would be a better way to validate all the ranges of postal codes? </p>