title: How to validate date for MM/YY in javascript?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1056728/formatting-a-date-in-javascript">Formatting a date in JavaScript</a>  </p>
  </blockquote>
  
  
  
  <p>I have a form having lots of fields and all are validate through Java-script and one of them is for date.</p>
  
  <pre><code>&lt;td&gt;Credit Card Expiration Date&lt;/td&gt;&lt;td&gt;:&lt;input class="input" type="text" name="CC_expiration_date" id="CC_expiration_date"&gt;&lt;p&gt;(MM/YY)&lt;/p&gt;&lt;/td&gt;
  </code></pre>
  
  <p>Now I want that the user must enter the date in (MM/YY) format. How could I validate this using JavaScript?</p>
  
  <p>I tried to make a regular expression:</p>
  
  <pre><code>/^(\d{2})[-\/](\d{2})[-\/](\d{4})$/.exec(date); 
  </code></pre>
  
  <p>... but <em>didnt work</em>. </p>