Possible Duplicate:
How do I make part of a regular expression optional in Ruby?
I'm trying to build a regular expression with rubular to match:
On Feb 23, 2011, at 10:22 , James Bond wrote:
OR
On Feb 23, 2011, at 10:22 AM , James Bond wrote:
Here's what I have so far, but for some reason it's not matching? Ideas?
(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:)
How can I make the AM/PM text optional? Either match AM/PM or neither?