From 5172a8894e5fd470bbf441111412f2cf0b9da064 Mon Sep 17 00:00:00 2001 From: Kadir Can Ozden <101993364+bysiber@users.noreply.github.com> Date: Fri, 20 Feb 2026 08:27:52 +0300 Subject: [PATCH] Fix _TIMESTAMP_RE to match single-digit timestamps The regex \d+\.?\d+ requires at least one digit on each side of the optional decimal point. For single-digit values like "0" or "1", the first \d+ consumes the only digit and the second \d+ fails to match anything. Change the trailing \d+ to \d* so the decimal part is fully optional, allowing single-digit timestamps like epoch 0 to be parsed with the X format token. --- arrow/parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arrow/parser.py b/arrow/parser.py index fc3774b0..96f0404c 100644 --- a/arrow/parser.py +++ b/arrow/parser.py @@ -166,7 +166,7 @@ class DateTimeParser: _TZ_NAME_RE: ClassVar[Pattern[str]] = re.compile(r"\w[\w+\-/]+") # NOTE: timestamps cannot be parsed from natural language strings (by removing the ^...$) because it will # break cases like "15 Jul 2000" and a format list (see issue #447) - _TIMESTAMP_RE: ClassVar[Pattern[str]] = re.compile(r"^\-?\d+\.?\d+$") + _TIMESTAMP_RE: ClassVar[Pattern[str]] = re.compile(r"^\-?\d+\.?\d*$") _TIMESTAMP_EXPANDED_RE: ClassVar[Pattern[str]] = re.compile(r"^\-?\d+$") _TIME_RE: ClassVar[Pattern[str]] = re.compile( r"^(\d{2})(?:\:?(\d{2}))?(?:\:?(\d{2}))?(?:([\.\,])(\d+))?$"