I’m looking for a regular expression which matches the following datetime format:
dd-MMM-yyyy HH:mm:ss (15-Sep-2011 16:00:47)
Currently I only have the regex for date which looks something like this:
^(3[0-1]|2[0-9]|1[0-9]|0[1-9])[\s{1}|\/|-](Jan|JAN|Feb|FEB|Mar|MAR|Apr|APR|May|MAY|Jun|JUN|Jul|JUL|Aug|AUG|Sep|SEP|Oct|OCT|Nov|NOV|Dec|DEC)[\s{1}|\/|-]\d{4}$
Any ideas for the time part?
It’s ok guys I found the solution. Submitting for anyone who wants to utilise it.
(3[0-1]|2[0-9]|1[0-9]|0[1-9])[\s{1}|\/|-](Jan|JAN|Feb|FEB|Mar|MAR|Apr|APR|May|MAY|Jun|JUN|Jul|JUL|Aug|AUG|Sep|SEP|Oct|OCT|Nov|NOV|Dec|DEC)[\s{1}|\/|-]\d{4}\s(20|21|22|23|[0-1]?\d):[0-5]?\d:[0-5]?\d
As Joel suggested above that I should add my solution as an answer here.
So here it is:
Do let me know if it works out.