diff --git a/src/dotenv/parser.py b/src/dotenv/parser.py index eb100b47..701aff58 100644 --- a/src/dotenv/parser.py +++ b/src/dotenv/parser.py @@ -59,7 +59,7 @@ def set(self, other: "Position") -> None: def advance(self, string: str) -> None: self.chars += len(string) - self.line += len(re.findall(_newline, string)) + self.line += string.count("\n") + string.count("\r") - string.count("\r\n") class Error(Exception):