From 759bd11feab292594e54288d454be129b5c9c9e6 Mon Sep 17 00:00:00 2001 From: Fabien Dubuy <59292746+fdubuy@users.noreply.github.com> Date: Tue, 25 Jun 2024 19:21:48 +0200 Subject: [PATCH] feature: better support for accented characters in date parsing --- src/documents/parsers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/documents/parsers.py b/src/documents/parsers.py index ed70f653d..ae19d5b53 100644 --- a/src/documents/parsers.py +++ b/src/documents/parsers.py @@ -39,11 +39,11 @@ from documents.utils import run_subprocess DATE_REGEX = re.compile( r"(\b|(?!=([_-])))([0-9]{1,2})[\.\/-]([0-9]{1,2})[\.\/-]([0-9]{4}|[0-9]{2})(\b|(?=([_-])))|" r"(\b|(?!=([_-])))([0-9]{4}|[0-9]{2})[\.\/-]([0-9]{1,2})[\.\/-]([0-9]{1,2})(\b|(?=([_-])))|" - r"(\b|(?!=([_-])))([0-9]{1,2}[\. ]+[a-zA-Z]{3,9} [0-9]{4}|[a-zA-Z]{3,9} [0-9]{1,2}, [0-9]{4})(\b|(?=([_-])))|" + r"(\b|(?!=([_-])))([0-9]{1,2}[\. ]+[a-zA-ZÀ-ÖØ-öø-ÿ]{3,9} [0-9]{4}|[a-zA-ZÀ-ÖØ-öø-ÿ]{3,9} [0-9]{1,2}, [0-9]{4})(\b|(?=([_-])))|" r"(\b|(?!=([_-])))([^\W\d_]{3,9} [0-9]{1,2}, ([0-9]{4}))(\b|(?=([_-])))|" r"(\b|(?!=([_-])))([^\W\d_]{3,9} [0-9]{4})(\b|(?=([_-])))|" r"(\b|(?!=([_-])))([0-9]{1,2}[^ ]{2}[\. ]+[^ ]{3,9}[ \.\/-][0-9]{4})(\b|(?=([_-])))|" - r"(\b|(?!=([_-])))(\b[0-9]{1,2}[ \.\/-][a-zA-Z]{3}[ \.\/-][0-9]{4})(\b|(?=([_-])))", + r"(\b|(?!=([_-])))(\b[0-9]{1,2}[ \.\/-][a-zA-ZÀ-ÖØ-öø-ÿ]{3}[ \.\/-][0-9]{4})(\b|(?=([_-])))", )