Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi ,

What I am trying to do so far is trying to create regular expression for below format

10/12/1990, 02:45 PM


Can anyone please provide me exact regular expression for this fomrat.

What I have tried:

I have created regular expression till date but unable to get it how to combine both time and date with comma separated and space in between

/^((0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])[- /.](19|20)?[0-9]{2})*$/
Posted
Updated 31-May-18 2:09am
Comments
Jochen Arndt 31-May-18 8:04am    
It depends on the allowed date time separation sequences and if the time part is optional. But it is not much different from the patterns for the date portions.

1 solution

Try :
\d{1,}/\d{1,}/\d{4}, \d{1,}:\d{2} [AP]M
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900