Skip to content

Instantly share code, notes, and snippets.

@amarjeetsahoo
Created August 6, 2021 06:55
Show Gist options
  • Save amarjeetsahoo/dd2c1a5bae6c59a17f39efaf678e3d86 to your computer and use it in GitHub Desktop.
Save amarjeetsahoo/dd2c1a5bae6c59a17f39efaf678e3d86 to your computer and use it in GitHub Desktop.
strong-password-regular expression for JavaScript & TypeScript
  • Passwords will contain at least 1 upper case letter
  • Passwords will contain at least 1 lower case letter
  • Passwords will contain at least 1 number or special character
  • There is no length validation (min, max) in this regex!

Regular expression for JavaScript:

/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment