title: Regular expression for recognizing different date formats
body: <p>I have to recognize different date formats from a string as below using regular expression.</p>
  
  <pre><code>date can contain 21/12/2018
  or 12/21/2018
  or 2018/12/21
  or 12/2018
  or 21-12-2018
  or 12-21-2018
  or 2018-12-21
  or 21-Jan-2018
  or Jan 21,2018
  or 21st Jan 2018
  or 21-Jan-2018
  or Jan 21,2018
  or 21st Jan 2018
  or Jan 21, 2018
  or Jan 21, 2018
  or 2018 Dec. 21
  or 2018 Dec 21
  or 21st of Jan 2018
  or 21st of Jan 2018
  or Jan 2018
  or Jan 2018
  or Jan. 2018
  or Jan, 2018
  or 2018
  [should recognize (year only), (year and month), (year, month and day), year is mandatory in every date format to be recognized]  
  [months are abbreviated to three letters, first letter capital]
  </code></pre>
  
  <p>my regular expression is as below, </p>
  
  <pre><code>\b(((((0?[1-9]|[12][0-9]|3[01])(\s*(st|nd|rd|th)?\s*(of)?\s*)?)|(20[012]\d)|(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec))[\/\-\.\,\s]*){1,3})\b
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/on5Sg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/on5Sg.jpg" alt="debuggex.com"></a>
  it is not working as expected and its getting other patterns also. I have to recognize three pattens <code>(year only)</code>, <code>(year and month)</code>, <code>(year, month and day)</code>, <strong>year is mandatory</strong> in every date pattern to be recognized.
  <strong>What are the corrections needed for it to work properly?</strong> Please help.</p>