From c1047d42b82d265b84ef06d30679dcd37dd10aa3 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Tue, 10 Mar 2020 11:37:08 -0400 Subject: [PATCH] regex --- MVMCoreUI/FormUIHelpers/New/Rules/RuleRegexModel.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MVMCoreUI/FormUIHelpers/New/Rules/RuleRegexModel.swift b/MVMCoreUI/FormUIHelpers/New/Rules/RuleRegexModel.swift index bc66fd1a..db1c4859 100644 --- a/MVMCoreUI/FormUIHelpers/New/Rules/RuleRegexModel.swift +++ b/MVMCoreUI/FormUIHelpers/New/Rules/RuleRegexModel.swift @@ -12,8 +12,12 @@ public class RuleRegexModel: RulesProtocol { public static var identifier: String = "regex" public var type: String = RuleRegexModel.identifier public var fields: [String] + public var regex: String public func isValid(_ formField: FormFieldProtocol) -> Bool { + if let stringToValidate = formField.formFieldValue() as? String { + return MVMCoreUIUtility.validate(stringToValidate, withRegularExpression: regex) + } return false } }