-1

I have a series of dates that I am trying to separate into years, months and days. These dates are in the yyyy-mm-dd format. I'm not very familiar with RegEx, but I have tried (\dddd)\-(\dd)\-(\dd).

Any help is appreciated.

4

1 回答 1

0

接受的答案也将匹配无效日期,如 1234-56-78,或者如果 mm 和 dd 位于错误的位置。

([1-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])

做更多的验证。

于 2019-01-28T22:54:09.547 回答