Javascript validation for DD/MM/YY
I need to check for this in javascript. So开发者_Go百科 i need to pass in something like this
var validdate = ^([0]?[1-9]|[1|2][0-9]|[3][0|1])[./-]([0]?[1-9]|[1][0-2])[./-]([0-9]{4}|[0-9]{2})$;
This is throwing a "expected expression" error in VS. Whats wrong with that expression? Thanks for helping guys!
You're getting an error, because in JS a RegExp literal starts and ends with a slash (/)
var validdate = /^([0]?[1-9]|[1|2][0-9]|[3][0|1])[.\/-]([0]?[1-9]|[1][0-2])[.\/-]([0-9]{4}|[0-9]{2})$/;
精彩评论