我的密码正则表达式是
- (NSString *) getRegularExpression:(NSString *)extraWords
{
/*
* ^$ Empty string
* | Or
* ^ Start of a string
* [] Explicit set of characters to match
* ^[:space:] Matches any non-white-space character - equivalent to \S
* {6,30} 6-20 characters
* $ End of a string
*/
return @"^$|^[^[:space:]]{6,20}$";
}
我该如何写一个包含以上要求的确认密码正则表达式,它也等于我的密码字符串。谁能帮助我?
匹配这些约束和密码的表达式:
- (NSString *) getRegularExpression: (NSString *) extraWords
{
/*
* ^$ Empty string
* | Or
* ^ Start of a string
* [] Explicit set of characters to match
* ^[:space:] Matches any non-white-space character - equivalent to \S
* {6,30} 6-20 characters
* $ End of a string
* (?=...)(?=...) And Operators
*/
// eg: @"^$|(?=^[^[:space:]]{6,20}$)(?=^password$)"
return [NSString stringWithFormat:@"^$|(?=^[^[:space:]]{6,20}$)(?=^%@$)", extraWords];
}
extraWords用于接收密码字符串。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句