Skip to content

Instantly share code, notes, and snippets.

@a4t
Created January 7, 2021 04:58
Show Gist options
  • Save a4t/0f49bbe73884ca97f4bc6a18409f0b38 to your computer and use it in GitHub Desktop.
Save a4t/0f49bbe73884ca97f4bc6a18409f0b38 to your computer and use it in GitHub Desktop.
python_password_valid
def _has_digit(password):
"""
パスワードに半角数字が含まれるかをチェックします。
Args:
チェック対象のパスワード
Returns:
半角数字を含んでいればTrue
"""
m = re.search(r'[0-9]', password)
return True if m else False
def _has_lower_letter(password):
"""
パスワードに英字小文字が含まれるかをチェックします。
Args:
チェック対象のパスワード
Returns:
英字小文字を含んでいればTrue
"""
m = re.search(r'[a-z]', password)
return True if m else False
def _has_upper_letter(password):
"""
パスワードに英字大文字が含まれるかをチェックします。
Args:
チェック対象のパスワード
Returns:
英字大文字を含んでいればTrue
"""
m = re.search(r'[A-Z]', password)
return True if m else False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment