Skip to content

Instantly share code, notes, and snippets.

@arielweinberger
Last active June 12, 2024 09:45
Show Gist options
  • Save arielweinberger/18a29bfa17072444d45adaeeb8e92ddc to your computer and use it in GitHub Desktop.
Save arielweinberger/18a29bfa17072444d45adaeeb8e92ddc to your computer and use it in GitHub Desktop.
Strong password Regular Expression - NestJS Course
  • 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]).*$/
@ezexedge
Copy link

genial!!!!!

@H-ROD-10
Copy link

H-ROD-10 commented Aug 8, 2021

super course

@ahammed3216
Copy link

excellent course sir

@francislagares
Copy link

Such a great course, I'm already in love with NestJS.

@marcusp619
Copy link

Thanks for the course!

@rezahmady
Copy link

cool course!β€οΈπŸ‘Œ

@italianog
Copy link

Fantastic course! <3

@Falence
Copy link

Falence commented Nov 1, 2021

Amazing course! Thank you.

@milad4444
Copy link

thank you very much

@erezliber
Copy link

Awesome course!

@BarkaouiMohamed
Copy link

Great course! Thank you

@willGatos
Copy link

AwesomeCourse!!!

@mskmx
Copy link

mskmx commented Mar 21, 2022

Thanks for all!!

@omaelnguessan
Copy link

Thanks for all πŸ‘

@pabcor
Copy link

pabcor commented May 13, 2022

Appreciate it, thanks! πŸ‘Œ

@omaelnguessan
Copy link

Thanks for all πŸ‘

@abelsouzacosta
Copy link

Appreciate it, great course.

@Juancho997
Copy link

Taking and loving the course! Keep up the good work @arielweinberger!

@DDowl51
Copy link

DDowl51 commented Oct 15, 2022

Great course! Thanks!

@ajspeller
Copy link

Thank you!!

@jonathan0223
Copy link

Just Awesome, thank you !

@VincentBernier35
Copy link

Many thanks, this course is great !

@mattstuhring
Copy link

mattstuhring commented Dec 8, 2022

Excellent course! I appreciate that I can learn Typescript and NestJS in parallel.

@UmutSERIFLER
Copy link

It is so helpful course, thanks a lot

@imadueno
Copy link

amazing course πŸš€

@joseTrejosFF
Copy link

Great course! πŸš€

@alieslamifard
Copy link

Well done @arielweinberger πŸš€
Let me offer my two cents on how we can use class-validator to validate a password.

@IsStrongPassword({
    minLength: 8,
    minLowercase: 1,
    minNumbers: 1,
    minSymbols: 1,
    minUppercase: 1
})

The default error message is password is not strong enough

@johnsonsirv
Copy link

Well done @arielweinberger πŸš€ Let me offer my two cents on how we can use class-validator to validate a password.

@IsStrongPassword({
    minLength: 8,
    minLowercase: 1,
    minNumbers: 1,
    minSymbols: 1,
    minUppercase: 1
})

The default error message is password is not strong enough

Cool πŸš€ thanks for sharing too.

@cyblogerz
Copy link

Thanks for this @arielweinberger πŸ”₯

@seunAwonugba
Copy link

with class validator, you can also pass in a custom error message is its not a strong password
@IsStrongPassword({}, { message: STRONG_PASSWORD })
password: string;

export const STRONG_PASSWORD =
'Your password must be at least 8 characters long, contain at least one number and have a mixture of uppercase and lowercase letters';

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