I'm using the swiftValdator framework for iOS development. I created a custom validator class with a regex.
The error is:
'NSInternalInconsistencyException', reason: 'Can't do regex matching, reason: Can't open pattern U_REGEX_MISSING_CLOSE_BRACKET (string lol, pattern ^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[,.:=+-_|)(%$#@!£/?';&"\])[A-Za-z0-9,.:=+-_|)(%$#@!]£/?';&"\]{8,32}, case 0, canon 0)'
This is my code:
import Foundation
import SwiftValidator
class CustomPasswordRule: RegexRule {
//^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[,.:=+\-_|)(%$#@!£/?`;&"\\])[A-Za-z\d,.:=+\-_|)(%$#@!£/?`;&"\\]{8,32}
static let regex = "^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[,.:=+-_|)(%$#@!£/?';&\"\\])[A-Za-z0-9,.:=+-_|)(%$#@!]£/?';&\"\\]{8,32}"
convenience init(message: String = "Not a valid Password") {
self.init(regex: CustomPasswordRule.regex,message: message)
}
}
Can anyone help me with the error? These are the conditions:
- Password must be between 8 and 32 characters in length.
- Password must contain any 3 of the following characters combinations:
- 1 Uppercase (capital) letter [A-Z]
- 1 Lowercase (common) letter [a-z]
- 1 Number [0-9]
- 1 Symbol [, . : = + - _ | ) ( % $ # @ ! £ / \ ? ` ; & "]