Reputation: 85
I have been googling about and need a valid regular expression statement (which begins and ends with the same character) which will validate for DD-MMM-YYYY or DD-MMM-YYYY HH:SS.
It does not matter about checking for valid dates (such as 31-Feb-2013 would be OK) it is just the formatting I require.
For example:
The checking for valid dates is done elsewhere but this is just for a formatting prompt.
I've done a search but i can't seem to find one with an opation time section like i need and where the regex starts and ends with the same characters to not cause an error.
Thanks,
Upvotes: 1
Views: 3304
Reputation: 11
for DD-MMM-YYYY
you can use this regex ^[01][0-9]-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-\d{4}$
Example:http://www.regexr.com/3bdeu
Upvotes: 1