diff --git a/lib/src/processing/whitespace.dart b/lib/src/processing/whitespace.dart index 6dc2e74a3f..bf5cf40277 100644 --- a/lib/src/processing/whitespace.dart +++ b/lib/src/processing/whitespace.dart @@ -226,8 +226,7 @@ class WhitespaceProcessing { /// (4) Replace any instances of two or more spaces with a single space. static String _removeUnnecessaryWhitespace(String text) { return text - .replaceAll(RegExp(r" *(?=\n)"), "") - .replaceAll(RegExp(r"(?<=\n) *"), "") + .replaceAll(RegExp(r" *\n *"), "\n") .replaceAll("\n", " ") .replaceAll("\t", " ") .replaceAll(RegExp(r" {2,}"), " ");