当你回首往事时,不因碌碌无为而悔恨,不为虚度年华而羞耻,那你就可以很骄傲地和自己讲,你不负此生!
今天分享一个密码的正则,密码必须包含大、小写字母、数字、特殊符号至少三种,且长度为8-20
1 | ^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&*`~()-+=]+$)(?![0-9\W_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]{8,20}$ |
javascript
代码
1 | if (!(/^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&*`~()-+=]+$)(?![0-9\W_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]{8,20}$/.test(value))) { |
java
代码
1 | String str = ""; |