SwiftValidatorCommunity/SwiftValidator

HIPAA policy compliance

alexszilagyi opened this issue · 0 comments

I am trying to contribute to this repo but first I am facing some issues. Maybe I did not get the documentation right.

I'm trying to add SpecialCharacterRule.swift

class SpecialCharacterRule: RegexRule {

    static let regex = "[!\"#$%&'()*+,-./:;<=>?@\\[\\\\\\]^_`{|}~]+"

    convenience init(message : String = "Password must contain %1$s or more special characters"){
        self.init(regex: SpecialCharacterRule.regex, message : message)
    }
}

NumericalSequencesRule.swift

class NumericalSequencesRule: RegexRule {

    static let regex = ##"^(?:0(?=1|$))?(?:1(?=2|$))?(?:2(?=3|$))?(?:3(?=4|$))?(?:4(?=5|$))?(?:5(?=6|$))?(?:6(?=7|$))?(?:7(?=8|$))?(?:8(?=9|$))?(?:9$)?$"##

    convenience init(message : String = "Password contains the illegal numerical sequence '%1$s"){
        self.init(regex: NumericalSequencesRule.regex, message : message)
    }
}

and QwertyRule.swift

class QwertyRule: RegexRule {

    static let regex = ##".*\\b\qwerty\\b.*"##
    
    convenience init(message : String = "Password contains the illegal QWERTY sequence '%1$s"){
        self.init(regex: QwertyRule.regex, message : message)
    }
}

Am I missing something? Why the conditions are not working? Meaning: SpecialCharacterRule, NumericalSequencesRule & QwertyRule does not pass and always returns invalid state !??!