javascript - how to write the regular expression to allow dashes in the date -
i write regular expression below
var validformat = /\d\d?[\-\/]\d\d?[\-\/](19\d\d|200\d)$/
it wont take dates : 08-12-2008 08/12/2008 works. what's problem?
you presumably had trailing whitespace @ end broke $ field. otherwise regex written fine.
paste code proving actual string date "08-12-2008" did not match...
remove $ , verify matched. proves it's $.
Comments
Post a Comment