[英]Regular Expression for atleast one character and one number with no repeat more than two
I am trying one of regular expression for condition like: 我正在尝试以下条件的正则表达式之一:
atleast 1 number, atleast 1 character, should be 3 to 16 digit long. 至少1个数字,至少1个字符,应为3到16位数字。 No character and number should repeat more than 2 time. 字符和数字的重复次数不得超过2次。
I tried one regular expression here what i tried. 我在这里尝试了一个正则表达式。
(^(?=.*\d)(?=.*[a-zA-Z]).{3,16}$)\1{2,}
but it did not do the trick. 但这并不能解决问题。
example for valid and invalid post: 有效和无效帖子的示例:
advan@123 -valid advan @ 123-有效
advan@4 -valid advan @ 4-有效
advvvan@123 -invalid advvvan @ 123-无效
advan@11123 -invalid advan @ 11123-无效
You can try using this regex ( edited to fail strings that have triple consecutive symbols): 您可以尝试使用此正则表达式(已编辑为具有三个连续符号的失败字符串):
^(?=.*[0-9])(?=.*[a-zA-Z])(?!.*(.)\1\1.*).{3,16}$
See example here . 在这里查看示例 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.