regex
This commit is contained in:
parent
f8589aabfc
commit
c1047d42b8
@ -12,8 +12,12 @@ public class RuleRegexModel: RulesProtocol {
|
|||||||
public static var identifier: String = "regex"
|
public static var identifier: String = "regex"
|
||||||
public var type: String = RuleRegexModel.identifier
|
public var type: String = RuleRegexModel.identifier
|
||||||
public var fields: [String]
|
public var fields: [String]
|
||||||
|
public var regex: String
|
||||||
|
|
||||||
public func isValid(_ formField: FormFieldProtocol) -> Bool {
|
public func isValid(_ formField: FormFieldProtocol) -> Bool {
|
||||||
|
if let stringToValidate = formField.formFieldValue() as? String {
|
||||||
|
return MVMCoreUIUtility.validate(stringToValidate, withRegularExpression: regex)
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user