我有以下正则表达式:
Regex pattern = new Regex(@"^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z]{8,20}/(.)$");
(?=.*\d) //should contain at least one digit
(?=.*[a-z]) //should contain at least one lower case
(?=.*[A-Z]) //should contain at least one upper case
[a-zA-Z0-9]{8,20} //should contain at least 8 characters and maximum of 20
我的问题是我还需要检查 3 个连续字符是否相同。搜索后,我看到了这个解决方案:
/(.)\1\1/
但是,如果我将它与我现有的正则表达式结合起来,我将无法使其工作,仍然没有运气:
Regex(@"^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z]{8,20}$/(.)\1\1/");
我在这里错过了什么?谢谢!