title: Validate time with am and pm using JavaScript RegEx
body: <p>I am not very good with regex. I have the following time: <code>12:00am</code>.</p>
  
  <p>I need a Javascript regex that respect this format: <code>hh:mm[am/pm]</code></p>
  
  <pre><code>var regex = /^(\d\d):(\d\d)\s?(?:AM|PM)?$/;
  </code></pre>