Since you stated this is homework in Date pattern matching and that you are not allowed external modules (not reinventing goodmodules is the correct way) - I am only going to give a nudge in the right direction.
Don't use a regex, use split, as how to do that I am going to leave that up to you. That should get you what you want most of the time