When it comes to date formatting in PHP, I typically use the format d-M-Y. Recently, I attempted to match these dates using a JavaScript regex:
s.match(new RegExp(/^(\d{1,2})(\-)(\w{3})(\-)(\d{4})$/))
I wanted to use this regex with the jQuery plugin, tablesorter. However, I encountered an issue as it didn't work as expected.
In order to troubleshoot, I decided to remove the dashes in my date() formatting (d M Y) and used the following regex, which surprisingly worked:
s.match(new RegExp(/^\d{1,2}[ ]\w{3}[ ]\d{4}$/));
So, my question is, what is the correct regex pattern to use if I want to match dates with dashes, like PHP's date() format d-M-Y? Any assistance would be greatly appreciated. Thanks!