I'm now working on the practice projects in this book and would like to get some advice on the project below to know if I'm on track.
Write a function that uses regular expressions to make sure the password string it is passed is strong. A strong password is defined as one that is at least eight characters long, contains both uppercase and lowercase characters, and has at least one digit. You may need to test the string against multiple regex patterns to validate its strength.
I came up with the below but not quite sure where to go from here. Appreciate if anyone could help! Thanks in advance!
#! /usr/bin/env python3
#chapter_7.py - Detects strong passwords.
import pyperclip, re
strong_pwd_regex = re.compile(r'(A-Za-z)(0-9)+{8,}')
password = str(pyperclip())
matches = []
for groups in strong_pwd_regex.findall(password):
if len(matches) < 8:
print('Password needs to be at least 8 characters long.')