Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
用于检查字符串是否至少包含一个[a-z]&的正则表达式[0-9]。两个[A-Z]和这里的整个更严格代码的长度应该是 4 到 10 个字符。
[a-z]
[0-9]
[A-Z]
我已经尝试了很长时间......但我无法做到。
/^(?=.*?[a-z])(?=.*?[0-9])(?=.*?[A-Z].*?[A-Z]).{4,10}$/
但是,使用单个正则表达式分别进行四个测试或者getStringLength()会更具可读性和可维护性。
getStringLength()