How to use Regular Expression to express Date and Time format like this: YYYY-MM-DD HH:MM:SS.XXX, use the standard Regular Expression. For example, "2018-08-01 23:58:32.425","2018-08-01 23:58:29.250","2016-11-01 19:10:34.911", I list some time & date strings.
You can use the following regex:
^\d\d\d\d-(0?[1-9]|1[0-2])-(0?[1-9]|[12][0-9]|3[01]) (00|[0-9]|1[0-9]|2[0-3]):([0-9]|[0-5][0-9]):([0-9]|[0-5][0-9])\.(\d{3})$
It will match the format:
YYYY-MM-DD HH:MM:SS.fff
Test the regex here.