 
 }
 
+func findMatch(for regex: String, in text: String) -> String? {
+    do {
+        let regex = try NSRegularExpression(pattern: regex)
+        let results = regex.matches(in: text, range: NSRange(text.startIndex..., in: text))
+        return results.compactMap {
+            guard let range = Range($0.range, in: text) else {
+                print("Unable to create the range for: \(text)")
+                return nil
+            }
+            return String(text[range])
+        }.first
+    } catch let error {
+        print("invalid regex: \(error.localizedDescription)")
+        return nil
+    }
+}
+
+func getVersion(from string: String) -> Version? {
+    let components = string.components(separatedBy: ",")
+    guard components.count == 2 else {
+        print("Can't create components of string: \(string)")
+        return nil
+    }
+    let majorString = components[0].trimmingCharacters(in: .whitespacesAndNewlines)
+    let minorString = components[1].trimmingCharacters(in: .whitespacesAndNewlines)
+
+    guard let major = Int(majorString), let minor = Int(minorString) else {
+        print("Can't create major: \(majorString) and  minor: \(minorString)")
+        return nil
+    }
+    return Version(major: major, minor: minor)
+}
+
 // MARK: - Calling Main
 
 main()

    }
}

func getUniqueSortedModels(havingPrefix: String, from deviceList: [String: [String: AnyObject]]) -> [Model] {

    let filteredDict = deviceList.filter { $0.key.hasPrefix(havingPrefix) }
    let models: [Model] = filteredDict.values.compactMap {

        guard let version = $0["version"] as? NSNumber, let enumCase = $0["enum"] as? String else {
            print("Can't create model from this: \($0)")
            return nil
        }
        return Model(version: version.doubleValue, enumCase: enumCase)
    }

    // Get the unique models i.e. ignore models which has same enum, we don't want same enum twice in case that


struct Model: Hashable {

    let version: Version
    let enumCase: String

    func hash(into hasher: inout Hasher) {
