         // cf. https://bugs.swift.org/browse/SR-10896
         guard self.first != "\u{FEFF}" || self.compareCount(with: 16) == .greater else {
             let startIndex = self.index(after: self.startIndex)
-            return self[startIndex...].replacingOccurrences(of: LineEnding.regexPattern, with: "", options: .regularExpression).count + 1
+            return self[startIndex...].replacingOccurrences(of: LineEnding.allCases.regexPattern, with: "", options: .regularExpression).count + 1
         }
         
-        return self.replacingOccurrences(of: LineEnding.regexPattern, with: "", options: .regularExpression).count
+        return self.replacingOccurrences(of: LineEnding.allCases.regexPattern, with: "", options: .regularExpression).count
     }
     
     

    /// The first line ending type.
    var detectedLineEnding: LineEnding? {
        
        guard let range = self.range(of: LineEnding.regexPattern, options: .regularExpression) else { return nil }
        
        // -> Swift treats "\r\n" also as a single character.
        let character = self[range.lowerBound]

    /// - Returns: String replacing line ending characers.
    func replacingLineEndings(with lineEnding: LineEnding) -> String {
        
        return self.replacingOccurrences(of: LineEnding.allCases.regexPattern, with: lineEnding.string, options: .regularExpression)
    }
    
    
