From 1ca7cccf1702878ba343dd2114419c6d8be12f17 2021-02-26 22:23:00 From: Brett Smith Date: 2021-02-26 22:23:00 Subject: [PATCH] txn_date: Refine the filename regexp. --- diff --git a/conservancy_beancount/plugin/txn_date.py b/conservancy_beancount/plugin/txn_date.py index 41f8de26305edea84203307ea562838a9f0d7575..4eb582f7b58e697d9f07e82c2e1024f1f9fe7d5c 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: