我正在尝试构建一个正则表达式来验证我的应用程序中的密码。这是 PCRE (php)。我的正则表达式到目前为止看起来像这样/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*\(\)_\+\-\=\[\]\{\}\|'])(?=.*[^\\\/])(?=.{8,20})/我的标准如下minimum length: 8maximum length: 20require special character: truerequire uppercase: truerequire lowercase: truerequire number: truespecial character set: !@#$%^&*()_+-=[]{}|'excluded character set: \/一切正常,但排除的字符集除外。这个想法是密码不能包含该列表中指定的任何字符。谢谢您的帮助
1 回答
千万里不及你
TA贡献1784条经验 获得超9个赞
使用
/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*()_\-+=[\]{}|'])[^\/]{8,20}$/
见证明
选择:
/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*()_\-+=[\]{}|'])[A-Za-z0-9!@#$%^&*()_+\-=[\]{}|']{8,20}$/
minimum length: 8 <= {8,20}
maximum length: 20 <= {8,20}
require special character: true <= (?=.*[!@#$%^&*()_\-+=[\]{}|'])
require uppercase: true <= (?=.*[A-Z])
require lowercase: true <= (?=.*[a-z])
require number: true <= (?=.*[0-9])
special character set: !@#$%^&*()_+-=[]{}|' <= [^\/]
excluded character set: \/ <= [^\/]
- 1 回答
- 0 关注
- 89 浏览
添加回答
举报
0/150
提交
取消