Skip to content

Instantly share code, notes, and snippets.

@kurzweil777
Created May 20, 2020 13:52
Show Gist options
  • Save kurzweil777/892dbf0aaad1d152ea88981d797b916e to your computer and use it in GitHub Desktop.
Save kurzweil777/892dbf0aaad1d152ea88981d797b916e to your computer and use it in GitHub Desktop.
Regular Expressions
import re
def strong_pass(your_pass):
passRegex1 = re.compile(r'''[A-Z]''') # Проверяем наличие больших букв
passRegex2 = re.compile(r'''[a-z]''') # Проверяем наличие маленьких букв
passRegex3 = re.compile(r'''\d''') # Проверяем наличие цифр
result = passRegex1.search(your_pass)
result2 = passRegex2.search(your_pass)
result3 = passRegex3.search(your_pass)
if len(your_pass) > 8 and result and result2 and result3:
print('Your Pass is Safe') # Если введенный пароль соответствует всем параметрам, то выводим это
else:
print('Your Pass is not Safe, please retype it using '
'at least one big and small letter, and at least one number') # Если введенный пароль не соответствует
# всем параметрам, то выводим это
strong_pass('w9e898we8F')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment