From 1ca7cccf1702878ba343dd2114419c6d8be12f17 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Fri, 26 Feb 2021 17:23:00 -0500 Subject: [PATCH] txn_date: Refine the filename regexp. --- conservancy_beancount/plugin/txn_date.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conservancy_beancount/plugin/txn_date.py b/conservancy_beancount/plugin/txn_date.py index 41f8de2..4eb582f 100644 --- a/conservancy_beancount/plugin/txn_date.py +++ b/conservancy_beancount/plugin/txn_date.py @@ -25,7 +25,8 @@ class TransactionDate(core.TransactionHook): "books dir setting is required to check transaction dates", ) books_pat = re.escape(str(books_path)) - self.filename_re = re.compile(rf'^{books_pat}/(\d{{4,}})[{os.path.sep}_.]') + path_sep = re.escape(os.path.sep) + self.filename_re = re.compile(rf'^{books_pat}{path_sep}(\d{{4,}})[\W_]') self.fy = config.fiscal_year_begin() def run(self, txn: Transaction) -> errormod.Iter: