-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.

Engineero
  • 10,387
  • 3
  • 41
  • 65
Brad Lee
  • 185
  • 10

1 Answers1

0

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.

stever
  • 1,168
  • 2
  • 11
  • 20