title: validation for 12 hours time with AM/PM using java script in PHP
body: <p>I am trying to validate the time in </p>
  
  <pre><code>00:00 to 11:59 ends with AM OR PM
  </code></pre>
  
  <p>I was tring some regex,but not getting succesful to validate time.
  My java script function is</p>
  
  <pre><code>function verifydata( incoming ) {
  var re = (1[012]|[1-9]):[0-5][0-9](\\s)?(?i)(am|pm);
  if(incoming.time.value != '' &amp;&amp; !incoming.time.value.match(re)) 
  {
  alert("Invalid time format: " + incoming.time.value);
  }
  }
  </code></pre>
  
  <p>its not working</p>
  
  <p>I tried this also, not working</p>
  
  <pre><code>var re = /^(?:[01][0-9]|2[0-3]):[0-5][0-9]$/;
  </code></pre>
  
  <p>let me where I am going wrong?</p>