Making part of the regex optional <p>Here is my regex:</p> <pre><code>/On.* \d{1,2}\/\d{1,2}\/\d{1,4} \d{1,2}:\d{1,2} (?:AM|PM),.*wrote:/ </code></pre> <p>to match:</p> <pre><code>On 3/14/11 2:55 PM, XXXXX XXXXXX wrote: </code></pre> <p>I need this Regex to also match:</p> <pre><code>On 25/03/2011, at 2:19 AM, XXXXX XXXXXXXX wrote: </code></pre> <p>So I tried this:</p> <pre><code>/On.* \d{1,2}\/\d{1,2}\/\d{1,4}(, at)? \d{1,2}:\d{1,2} (?:AM|PM),.*wrote:/ </code></pre> <p>But that breaks the other matches</p> <p>Am I making the (, at)? optional set right?</p> <p>Thanks</p>