RegexConstraint
public struct RegexConstraint : Constraint
A constraint to validate if a value matches a regular expression pattern.
-
A default regular expression pattern that matches to any character(s) or an empty string.
Declaration
Swift
public static let pattern: String
-
A default error message to show if no custom error message is provided.
Declaration
Swift
public static let message: String
-
A regular expression pattern.
Declaration
Swift
public let pattern: String
-
A custom error message.
Declaration
Swift
public let message: String
-
See
Constraint
.Declaration
Swift
public let groups: Set<Group>
-
A validator named
RegexValidator
to validate a value.Declaration
Swift
public let validator: ConstraintValidator
-
Initializes a new instance with a regular expression pattern, a custom error message and a set of
Group
s to group by.Declaration
Parameters
pattern
A regular expression pattern. Matches to any character(s) or an empty string by default.
message
A custom error message. Defaults to the default error message.
groups
A set of
Group
s to group by. Defaults to an empty set.