title: Regex for date pattern with optionnal year
body: <p>I try to write a regex for a date pattern (mm/dd/yyyy ; m/d/yy ; etc...) :</p>
  
  <pre><code>    ".*([0-9]+/[0-9]+/[0-9]+).*"
  </code></pre>
  
  <p>However for my usecase, the year can be omitted. In this case, I still want to match mm/dd. I tried to put the last group opional for that purpose:</p>
  
  <pre><code>    ".*([0-9]+/[0-9]+(/[0-9]+)?).*"
  </code></pre>
  
  <p>But it does not work with a full date pattern (R code below):</p>
  
  <pre><code>    str = "hello 2/5/2017 123"
      gsub(".*([0-9]+/[0-9]+(/[0-9]+)?).*", "\\1", str)
  </code></pre>
  
  <p>Result: </p>
  
  <pre><code>    [1] "5/2017"
  </code></pre>
  
  <p>Any idea of what I am doing wrong ?</p>