lucy24 - 10:07 pm on Aug 5, 2012 (gmt 0)
Seems like overkill. Do you have code at an earlier stage that forces dates into the form you've shown, yyyy-mm-dd ? If so you should be able to just tweak that code and work backward.
Picking up the yyyy-mm-dd piece as a raw Regular Expression, independent of content,* is so trivial that I'm not going to insult your intelligence by writing it out.So I assume you're really asking something a little more complicated ;)
* That is, if you don't care whether the person claims to have been born on 2012-08-05 or 1776-02-31 or even 2555-55-55. If the first-round code was careful, the third form will definitely never occur, probably not the second and maybe not the first.