Use strict regex when timeformat_strict config true

This commit is contained in:
Lenahan Michael 2020-09-30 16:29:49 +02:00
parent 455db728c0
commit 034e86762e

View file

@ -135,7 +135,9 @@ class Journal:
# (2) if timeformat_strict is set to true.
if self.config["timeformat"] == "%Y-%m-%d %H:%M":
if self.config["timeformat_strict"]:
date_blob_re = re.compile("(?:^|\n)\\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2})\\] ")
date_blob_re = re.compile(
"(?:^|\n)\\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2})\\] "
)
last_entry_pos = 0
for match in date_blob_re.finditer(journal_txt):