Search code examples
regexalteryx

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.


Solution

  • Accepted answer would also match invalid dates like 1234-56-78, or if mm & dd were in the wrong positions.

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

    Does a little more validation.