请提供验证码

编程入门 行业动态 更新时间:2024-10-22 13:48:05
本文介绍了请提供验证码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 请为我建议以下条件的验证码 1.Password必须至少有八(8)个字符。 2.密码必须至少有四(4)个字符类型中的三(3)个:小写字母,大写字母,数字和特殊字符。 3.Password不得与用户标识符相同。 4.密码不得包含三(3)个或更多重复字符。 谢谢 Rajshree lande

hello guys, please suggest me validation code for following conditions 1.Password must have a minimum of eight (8) characters. 2. Password must have at least three (3) of the four (4) character types: lowercase alphabetic, uppercase alphabetic,numeric, and special characters. 3.Password must not be the same as the user identifier. 4. Password must not contain three (3) or more repeating characters. thanks Rajshree lande

推荐答案

此类验证代码的实现非常简单(因此请考虑自己动手并在此处仅询问具体问题)。例如,假设用户输入的( string )变量为 pwd ,您可以检查点(1)使用以下代码: Implementation of such validation code is pretty trivial (so consider doing it yourself and ask here only specific questions). For instance, suppose the (string) variable entered by the user is pwd, the you may check point (1) using the following code: if (pwd.Lenght < 8) { return false; }

其他要点稍微复杂一些。

Other points are just a little bit more complex.

^(?=.*[A-Z])(?=.*\d)(?!.*(.)\1\1)[a-zA-Z0-9@]{6,12}

特殊字符 - 不允许 空格 - 不允许 最小和最大字段长度 - 6到12个字符 遇到[a-zA-Z0-9 @] {6,12} 数字角色 - 至少一个角色 遇到积极前瞻(?=。* \ d) 至少一封大写字母 遇见积极前瞻(?=。* [AZ]) 重复字符 - 仅允许两个重复字符 我不确定你的意思。否定前瞻(?!。*(。)\\\ 1)确保不允许任何字符连续出现两次以上。子串aa没关系,aaa不行。 制作它(?!。*(。+)\\\ 1)拒绝长度不止一个的重复子串(如ababab)或添加。*在\1之前拒绝不连续的重复出现。 参考: stackoverflow/questions/12899876/checking-strings-for-a-strong-enough-password [ ^ ] 或

Special Characters - Not Allowed Spaces - Not Allowed Minimum and Maximum Length of field - 6 to 12 Characters Met by [a-zA-Z0-9@]{6,12} Numeric Character - At least one character Met by positive lookahead (?=.*\d) At least one Capital Letter Met by positive lookahead (?=.*[A-Z]) Repetitive Characters - Allowed only two repetitive characters I am not sure what you mean by this. The negative lookahead (?!.*(.)\1\1) makes sure that no character is allowed to appear more than two times in a row. Substring aa is okay, aaa is not. Make it (?!.*(.+)\1\1) to reject repeated substrings of length more than one (like ababab) or add .* before \1 to reject non-continuous repeated appearances too. refer: stackoverflow/questions/12899876/checking-strings-for-a-strong-enough-password[^] OR

You can do these checks using positive look ahead assertions: <pre lang="xml">^(?=.*[A-Z].*[A-Z])(?=.*[!@#

更多推荐

请提供验证码

本文发布于:2023-11-11 07:05:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1577720.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:验证码

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!