 // MARK: - Regular Expression
 
 extension String {
-
+  
   /// **Mechanica**
   ///
   /// Returns a range equivalent to the given `NSRange` or `nil` if the range can't be converted.
   private func range(from nsRange: NSRange) -> Range<Index>? {
     guard let range = Range(nsRange) else { return nil }
-    let utf16Start = UTF16Index(range.lowerBound)
-    let utf16End = UTF16Index(range.upperBound)
-
+    
+    let utf16Start = UTF16Index(encodedOffset: range.lowerBound)
+    let utf16End = UTF16Index(encodedOffset: range.upperBound)
+    
     guard
       let start = Index(utf16Start, within: self),
       let end = Index(utf16End, within: self)
       else { return nil }
-
+    
     return start..<end
   }
-
+  
   /// **Mechanica**
   ///
   /// - Parameters:

  /// - Returns: returns a list of matched strings for `self`.
  func matches(for pattern: String, options: NSRegularExpression.Options = []) -> [String] {
    var strings: [String] = []
    for range in ranges(matching: pattern, options: options) {
      strings.append(self.substring(with: range))
    }
    return strings
  }

  /// **Mechanica**
  ///
  /// - Parameters:

  /// - Returns: returns a list of matched ranges for `self` or empy. Defaults to [].
  public func ranges(matching pattern: String, options: NSRegularExpression.Options = []) -> [Range<String.Index>] {
    guard let regex = try? NSRegularExpression(pattern: pattern, options: options) else { return [] }
    
    let matches = regex.matches(in: self, options: [], range: NSRange(location: 0, length: count))
    let ranges = matches.flatMap { return self.range(from: $0.range) }
    return ranges
  }
  
  /// **Mechanica**
  ///
  /// - Parameters:
