Date and Datetime regex

Hello,

Do you think it is possible to update date and datetime regex to add the start and end caret ?

Actually datetime regex is this one

-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5]0-9?(Z|(+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?

this regex match a standard date like

2014-05-12
2017-11-30T12:04:23.444+03:00

but, in some parser, this regex match also
2014-05-12UERF

whith theses expression
date ^-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1]))?)?$
datetime ^-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5]0-9?(Z|(+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?$

the wacky expressions like

2014-05-12UERF

become invalid

Regards

Stéphane GINER

If your regex parser requires the caret and dollar-symbol to validate correctly, you’re free to add them. However, they are not an appropriate part of the actual regular expression.