您的位置:首页 > 编程语言 > Python开发

Python 正则表达式验证密码完整性

2014-08-07 10:47 316 查看
Regular Expression

1. Length between 8 and 32 characters
^[\s\S]{8,32}$

2. ASCII visible and space characters only
Rule: match A-Z,0-9,a-z and ASCII punctualtion
no control characters, line breaks, characters out of the ASCII talbe are allowed
^[\x20-\x7E]+$

3. One or more uppercase letters
[A-Z]+

4. One or more lowercase letters
[a-z]+

5. One or more numbers
[0-9]+

6. One or more special characters
[ !"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~]

7. Anything other than ASCII letters and numbers
[^a-zA-Z0-9]

8. Disallow three or more sequential identical characters
([\s\S])\1\1

9. Mutil rules
Length between 8 and 32 characters
One or more upppercase letters
One or more lowerercase letters
One or more numbers
^(?=[\s\S]{8,32}$)(?=[\s\S]*[A-Z])(?=[\s\S]*[a-z])(?=[\s\S]*[0-9]).*
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: