问题描述
我想要一个正则表达式来检查:
I want a regular expression to check that:
密码至少包含八个字符,包括至少一个数字,同时包含大小写字母和特殊字符,例如#
、?
、!
.
A password contains at least eight characters, including at least one number and includes both lower and uppercase letters and special characters, for example #
, ?
, !
.
它不能是您的旧密码或包含您的用户名、"password"
或 "websitename"
It cannot be your old password or contain your username, "password"
, or "websitename"
这是我的验证表达式,它适用于八个字符,包括一个大写字母、一个小写字母和一个数字或特殊字符.
And here is my validation expression which is for eight characters including one uppercase letter, one lowercase letter, and one number or special character.
(?=^.{8,}$)((?=.*d)|(?=.*W+))(?![.
])(?=.*[A-Z])(?=.*[a-z]).*$"
密码必须是八个字符,包括一个大写字母、一个特殊字符和字母数字字符?
推荐答案
最少八个字符,至少一个字母和一个数字:
Minimum eight characters, at least one letter and one number:
"^(?=.*[A-Za-z])(?=.*d)[A-Za-zd]{8,}$"
最少八个字符,至少一个字母、一个数字和一个特殊字符:
Minimum eight characters, at least one letter, one number and one special character:
"^(?=.*[A-Za-z])(?=.*d)(?=.*[@$!%*#?&])[A-Za-zd@$!%*#?&]{8,}$"
最少八个字符,至少一个大写字母、一个小写字母和一个数字:
Minimum eight characters, at least one uppercase letter, one lowercase letter and one number:
"^(?=.*[a-z])(?=.*[A-Z])(?=.*d)[a-zA-Zd]{8,}$"
最少八个字符,至少一个大写字母,一个小写字母,一个数字和一个特殊字符:
Minimum eight characters, at least one uppercase letter, one lowercase letter, one number and one special character:
"^(?=.*[a-z])(?=.*[A-Z])(?=.*d)(?=.*[@$!%*?&])[A-Za-zd@$!%*?&]{8,}$"
最少 8 个字符,最多 10 个字符,至少 1 个大写字母、1 个小写字母、1 个数字和 1 个特殊字符:
Minimum eight and maximum 10 characters, at least one uppercase letter, one lowercase letter, one number and one special character:
"^(?=.*[a-z])(?=.*[A-Z])(?=.*d)(?=.*[@$!%*?&])[A-Za-zd@$!%*?&]{8,10}$"
这篇关于密码的正则表达式必须包含至少八个字符、至少一个数字以及大小写字母和特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!