java正則式判斷文件名合法
function testPath() {
var path = /^[a-zA-Z]:[\\]((?! )(?![^\\/]*\s+[\\/])[\w -]+[\\/])*(?! )(?![^.]*\s+\.)[\w -]+$/;
var backuppath = document.getElementById("xxx");
if (path.test(backuppath)) {
return true;
} else {
alert("請填寫正確路徑!");
return false;
}
return true;
}