$scope.validateWindowsPassWord = function (value) { if (value === ''){ return true; } if($scope.passwordServer.metadata.os_type=='windows' && $scope.passwordServer.metadata.windows_password_policy && $scope.passwordServer.metadata.windows_inject_path) { var reg = /^w{6,10}$/; var r = value.match(reg); if (r == null) { return false; } var wordReg = /(?=.*[A-Z])(?=.*[a-z])(?=.*[d])/; var word = value.match(wordReg); if (word == null) { return false } } return true; };
w 等价于 [a-zA-Z0-9_]
W 等价于 [^a-zA-Z0-9_],就是排除了w的情况,也就是说它们表示的意思相反