     public func count(regex: Regex) -> Int {
         let nsstring = NSString(string: self)
         let range = NSRange(location: 0, length: nsstring.length)
-        return regex.matcher.numberOfMatches(in: self, options: [], range: range)
+        return regex.regex.numberOfMatches(in: self, options: [], range: range)
     }
     
     /// Returns true if any match of the regular expression in the string.
     public func isMatch(regex: Regex) -> Bool {
         let nsstring = NSString(string: self)
         let range = NSRange(location: 0, length: nsstring.length)
-        return regex.matcher.firstMatch(in: self, options: [], range: range) != nil
+        return regex.regex.firstMatch(in: self, options: [], range: range) != nil
     }
     
     /// Returns the first match of the regular expression in the string.
     public func firstMatch(regex: Regex) -> String? {
         let nsstring = NSString(string: self)
         let range = NSRange(location: 0, length: nsstring.length)
-        let match_result = regex.matcher.firstMatch(in: self, options: [], range: range)
+        let match_result = regex.regex.firstMatch(in: self, options: [], range: range)
         return match_result.map { nsstring.substring(with: $0.range) }
     }
     

    public func replace(regex: Regex, template: String) -> String {
        let nsstring = NSString(string: self)
        let range = NSRange(location: 0, length: nsstring.length)
        return regex.matcher.stringByReplacingMatches(in: self, options: [], range: range, withTemplate: template)
    }
}


    
    public var description: String {
        return pattern
    }
}

extension Regex: Hashable {
    
    @inlinable
    public static func == (lhs: Regex, rhs: Regex) -> Bool {
        return lhs.pattern == rhs.pattern && lhs.options == rhs.options
    }
    
    @inlinable
    public func hash(into hasher: inout Hasher) {
        hasher.combine(self.pattern)
        hasher.combine(self.options.rawValue)
    }
}

