RegexRule
open class RegexRule : Rule
RegexRule is a subclass of Rule that defines how a regular expression is validated.
-
Method used to initialize
RegexRuleobject.Declaration
Swift
public init(regex: String, message: String = "Invalid Regular Expression")Parameters
regexRegular expression string to be used in validation.
messageString of error message.
Return Value
An initialized
RegexRuleobject, or nil if an object could not be created for some reason that would not result in an exception. -
Method used to validate field.
Declaration
Swift
public func validate(_ value: String) -> BoolParameters
valueString to checked for validation.
Return Value
Boolean value. True if validation is successful; False if validation fails.
-
Method used to dispaly error message when field fails validation.
Declaration
Swift
public func errorMessage() -> StringReturn Value
String of error message.
RegexRule Class Reference