txn_date: Refine the filename regexp.

This commit is contained in:
Brett Smith 2021-02-26 17:23:00 -05:00
parent 9598b29ba7
commit 1ca7cccf17

View file

@ -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: