JavaScript Regex for Date Validation in javascript regex date validation mm/dd/yyyy,regex date validation javascript,

Try this:

([0-9][1-2])/([0-2][0-9]|[3][0-1])/((19|20)[0-9]{2}) 

and then if you got a valid string from the above regex then with string manipulations, do something like below:

if(/([0-9][1-2])\/([0-2][0-9]|[3][0-1])\/((19|20)[0-9]{2})/.test(text)){
    var tokens = text.split('/');  //  text.split('\/');
    var day    = parseInt(tokens[0], 10);
    var month  = parseInt(tokens[1], 10);
    var year   = parseInt(tokens[2], 10);
}
else{
    //show error
    //Invalid date format
}
Answer:1

I have a rails app (on the dev server) and the application.js file is not loaded from the browser. When I make a direct call to the application.js file from the browser ex: myapp.com/assets/...

I have a rails app (on the dev server) and the application.js file is not loaded from the browser. When I make a direct call to the application.js file from the browser ex: myapp.com/assets/...

I am trying to push a value to a property of an array like below var obj = {}; obj.a = (obj.a || []).push(10); console.log( typeof obj.a ); // Returning number How can correct this to keep ...

I am trying to push a value to a property of an array like below var obj = {}; obj.a = (obj.a || []).push(10); console.log( typeof obj.a ); // Returning number How can correct this to keep ...

I'm having a serious trouble with attaching droppable functionality to dynamically created elements.! I cannot bind droppable when the item is created since there is an ajax call going when the a ...

I'm having a serious trouble with attaching droppable functionality to dynamically created elements.! I cannot bind droppable when the item is created since there is an ajax call going when the a ...

I have an object whose value may be undefined sometimes. So is it possible / valid / good practice to test it with an if case like below : if(params === undefined) { alert("sound." + params);...

I have an object whose value may be undefined sometimes. So is it possible / valid / good practice to test it with an if case like below : if(params === undefined) { alert("sound." + params);...