首页 > 解决方案 > Trying to separate the year month and day fields via RegEx

问题描述

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.

标签: regexalteryx

解决方案


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

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

做更多的验证。


推荐阅读