I’m trying to create a regex for a timestamp which could be formatted like this
2011-12-31T23:00:00.000+01:00
My closest solution I can think of is:
/^(\d{4})-(\d\d)-(\d\d)T:(\d\d):(\d\d).(\d{3})+(\d\d):(\d\d)$/
But that doesn’t seem to work.
Any suggestions on where I went wrong? (I’m using this in php preg_match() )
Thanks
It doesn’t work because you have
T:in your regex, yet noT:in your timestamp. And you didn’t escape out the+.Actually, between the
Tand:in your regex, put(\d\d):