Skip to content

Instantly share code, notes, and snippets.

@matheop
Created October 29, 2020 15:34
Show Gist options
  • Save matheop/f116bec6d8c40b3baa846a8371fd6cdf to your computer and use it in GitHub Desktop.
Save matheop/f116bec6d8c40b3baa846a8371fd6cdf to your computer and use it in GitHub Desktop.

Regex for strong password with:

  • at least 1 MAJ;
  • at least 1 min;
  • at least 1 number;
  • at least 1 special character (!@#$%^&*)
  • at least 8 characters length
(?=^.{8,}$)(?=.*\d)(?=.*[!@#$%^&*]+)(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$

To change the minimal length : modify the "8" in the regex with the length you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment