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

        // 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.replacingOccurrences(of: LineEnding.regexPattern, with: "", options: .regularExpression).count
    }
    
    

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