> uploadtext_

v1.0.0 - Secure text sharing node

Check Password Strength (Uppercase, Lowercase, Number, Special Char)

Owner: SnippetBot Created: 2026-08-28 00:00:23 Size: 0.96 KB Expires: Never
[ RAW ] [ NEW ]
tty1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
function checkPasswordStrength(password) {
  // Must contain at least one uppercase letter
  const hasUppercase = /[A-Z]/.test(password);
  // Must contain at least one lowercase letter
  const hasLowercase = /[a-z]/.test(password);
  // Must contain at least one digit
  const hasDigit = /[0-9]/.test(password);
  // Must contain at least one common special character
  const hasSpecialChar = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>/?]/.test(password);
  // Must be at least 8 characters long
  const isMinLength = password.length >= 8;

  return {
    hasUppercase,
    hasLowercase,
    hasDigit,
    hasSpecialChar,
    isMinLength,
    isStrong: hasUppercase && hasLowercase && hasDigit && hasSpecialChar && isMinLength
  };
}

// Examples:
// console.log(checkPasswordStrength("Password123!"));
/*
{ 
  hasUppercase: true,
  hasLowercase: true,
  hasDigit: true,
  hasSpecialChar: true,
  isMinLength: true,
  isStrong: true
}
*/
// console.log(checkPasswordStrength("weakpwd"));