title: Regex to match a String with optional Conditions
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5239883/how-do-i-make-part-of-a-regular-expression-optional-in-ruby">How do I make part of a regular expression optional in Ruby?</a>  </p>
  </blockquote>
  
  
  
  <p>I'm trying to build a regular expression with rubular to match:</p>
  
  <pre><code>On Feb 23, 2011, at 10:22 , James Bond wrote:
  </code></pre>
  
  <p>OR </p>
  
  <pre><code>On Feb 23, 2011, at 10:22 AM , James Bond wrote:
  </code></pre>
  
  <p>Here's what I have so far, but for some reason it's not matching? Ideas?</p>
  
  <pre><code>(On.* (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{1,2}, [12]\d{3}.* at \d{1,2}:\d{1,2} (?:AM|PM),.*wrote:)
  </code></pre>
  
  <p>How can I make the AM/PM text optional? Either match AM/PM or neither?</p>