我正在尝试在密码输入中为html5模式创建一个正则表达式。
密码必须至少包含:
任何帮助表示赞赏
答案 0 :(得分:0)
不是那么难:
( # Start of group
(?=.*\d) # must contain at least one digit
(?=.*[A-Z]) # must contain at least one uppercase character
(?=.*[a-z]) # must contain at least one lowercase character
(?=.*\W) # must contain at least one special symbol
\w
. # match anything with previous condition checking
{6,18} # length is characters
\w
) # End of group
在一行中:
((?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*\W)\w.{6,18}\w)
如果您不喜欢\w
等于[a-zA-Z0-9_]
,请将其替换为该组并删除下划线。
但是,我完全支持ctwheels'参数。