Skip to content

Instantly share code, notes, and snippets.

@ShahriyarR
Created December 6, 2022 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShahriyarR/30f587099224708511b3b8d8bd65709f to your computer and use it in GitHub Desktop.
Save ShahriyarR/30f587099224708511b3b8d8bd65709f to your computer and use it in GitHub Desktop.
import re
def validate_password(password: str) -> bool:
reg = r"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!#%*?&]{6,20}$"
pattern = re.compile(reg)
return bool(re.search(pattern, password))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment