Validate a string

Validate a string

Hi.

I have quite a simple problem, which I cant find the solution for.

var date = "12-02-2002";
var date2 = "55-66-2222";
var date3 = "1-02-k001";

How do I in the simplest way, validate these var´s, so that date and date2 validates, but date3 does not validate since its not in the right 'dd-mm-yyyy' format?

(Would it be alot more difficult, if the validator also checks the date, and therefore date2 wouldnt validate?)

Thanks alot :)