👨🏼‍💻개발/파이썬

파이썬 - 허용된 문자, 사용 가능한 비밀번호 문자들인지 검증하기 (re)

Janger 2023. 2. 3. 02:24
728x90

영문, 숫자, 특수 문자들로 구성된 비밀번호인지 확인하기

import re
password = raw_input("Enter string to test: ")
if re.fullmatch(r'[A-Za-z0-9!@#$%^&+=]{8,}', password):
    # match
else:
    # no match

 

 

출처: 

https://stackoverflow.com/questions/2990654/how-to-test-a-regex-password-in-python

 

How to test a regex password in Python?

Using a regex in Python, how can I verify that a user's password is: At least 8 characters Must be restricted to, though does not specifically require any of: uppercase letters: A-Z lowercase let...

stackoverflow.com

 

728x90