This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 months ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
基本上你在这里错过了一个开放的
[
字符组括号:你还应该使用 分隔符。括号的行为如下,但最好使用不同的对来避免捕获组的歧义:
这还添加了开始
^
和结束$
断言以匹配整个细绳。Basically you miss an opening
[
character group bracket here:And you should also use delimiters. The parens will behave as such, but it's better to use a different pair to avoid ambiguity with a capture group:
This also adds start
^
and end$
assertions to match the whole string.这可能更容易打破个人规则。即,一条规则检查密码是否至少有 8 个字符长,另一条规则检查大写字母,另一条规则检查小写字母,等等。
此外,看起来您在正则表达式方面有一些特殊字符而没有任何转义。例如,除某些特殊情况外,* 字符在正则表达式中具有特殊含义。它需要转义
\*
或放在方括号[*]
中This may be easier to break into individual rules. I.e. a rule to check if the password is at least 8 characters long, another to check for an uppercase, another for lowercase, etc.
Also, it looks like you have some special characters in terms of regular expressions without any escaping. For example, the * character has special meaning in regular expressions other than some special cases. It either needs to be escaped
\*
or in brackets[*]