I am getting a JSLint insecure exception error when trying to validate a password in JavaScript

33 Views Asked by At

while trying to validate the password with regular expression in the .js file I am getting the error as Run JSLint (if jslint.scan.dir=/src/...) Failed

this happens while building the application got the following exception

Insecure '.'.
`var passw= /^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/;`
                                                  ^
passwordPatternCheck : function passwordPatternCheck() {
  var patternCheck = function passPatternCheck(submittedValues, validation) {
    var result = null;
    var submitted = submittedValues[validation.name];
    var passw= /^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/;
    if (submitted && !submitted.match(passw)) {
      var displayName = validation.label || validation.name;
      result = i18n("Should have 8 or more characters with atlease one uppercase, one lowercase, one number and one special character as %s.", displayName);
    }
    return result;
  };
  return patternCheck;
},

tried to escape the dot[.] but the regex is not working as expected

(?=\.*[A-Z])(?=\.*[a-z])(?=\.*[0-9])(?=\.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$
0

There are 0 best solutions below