title: Pattern Matching checking zipcode between range
body: <p>The data entered should be processed to check if the zip code is included in service area  (This includes zip codes from 63121 to 69999). </p>
  
  <p>This is what I have done I know I'm doing pattern matching wrong. Any help will be appreciated! </p>
  
  <pre><code>function validate() {
      var zipCode = document.getElementById("zip");
      var ok = zipCode.value.search(/^(6|9)\d{3,9}\d{1,9}\d{2,9}\d{1,9}$/);
      if (ok != 0) {
          alert("Sorry no service");
          zipCode.focus();
          zipCode.select();
          return false;
      } else
          return true;
  }
  </code></pre>
  
  <hr>
  
  <p>HTML Part</p>
  
  <pre><code>&lt;form name = "myForm" action = ""  &gt;
  
          &lt;table align = "center" bgcolor = "FF6600" cellspacing = "3" cellpadding = "4" border = "1" style="font-family:Comic Sans;vertical-align:center;"&gt;
          &lt;caption style="background-color:#FFD700; text-align:left"&gt; &lt;font size="5" color="black"&gt;Check Coverage: &lt;/font&gt;&lt;/caption&gt;
              &lt;tr&gt;
                  &lt;td class="info"&gt;First Name&lt;/td&gt;
                  &lt;td&gt;&lt;input type = "text" name = "first" class="textright"&gt;*&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td class="info"&gt;Phone Number&lt;/td&gt;
                  &lt;td&gt;&lt;input type  = "text"  name  = "phone" size="10" maxlength = "12" class="textright" &gt;* (ddd-ddd-dddd)&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td class="info"&gt;Zip Code&lt;/td&gt;
                  &lt;td&gt;&lt;input type  = "text" id="zip" name = "zip1" size ="5" maxlength = "5" class="textright"&gt;* &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td class="size"&gt;* - Required Field&lt;/td&gt;
                  &lt;td&gt;&lt;input type = "button" class="but2" value ="Reset"&gt;&lt;input type = "submit" class= "but2" onclick="validate()" value ="Check Availability" &gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>