Revised the regular expression in the find_by_code method of the Account data model.

This commit is contained in:
依瑪貓 2023-02-27 10:50:49 +08:00
parent 83b5761bca
commit 88314e1e45

View File

@ -204,7 +204,7 @@ class Account(db.Model):
:param code: The code.
:return: The account, or None if this account does not exist.
"""
m = re.match("^([1-9]{4})-([0-9]{3})$", code)
m = re.match(r"^([1-9]{4})-(\d{3})$", code)
if m is None:
return None
return cls.query.filter(cls.base_code == m.group(1),