regularExpression = '[\w]:\\.*';
function validate() {
debugger;
var regex = new RegExp(regularExpression);
var ctrl = document.getElementById('txtValue');
if (regex.test(ctrl.value)) {
return true;
} else {
return false;
}
}
Above is my code with which I am validating a directory path being entered. Here is the link for validator website which shows the perfect match for C:\ or D:\
or D:\Abcd\List.odt
. But when I try to run the above JavaScript it fails.