fix timestamp_friends: ignore ordinal suffixes (st/nd/rd/th) in bare-hour regex
This commit is contained in:
1 parent
c485c4f6bf
commit
b51967dc9b
1 file changed
+1
-1
+1
-1
@@ -27,7 +27,7 @@ def has_ampm(text: str) -> bool:
|
|||||||
# in "3:00") and NOT followed by colon (excludes "3:00" hours). Captures
|
# in "3:00") and NOT followed by colon (excludes "3:00" hours). Captures
|
||||||
# an optional am/pm suffix separately.
|
# an optional am/pm suffix separately.
|
||||||
_HOUR_RE = re.compile(
|
_HOUR_RE = re.compile(
|
||||||
r"(?<!:)\b(\d{1,2})(?!\d)(?!\s*:)(?:\s*(am|a\.m\.?|pm|p\.m\.?))?",
|
r"(?<!:)\b(\d{1,2})(?!\d)(?!st\b|nd\b|rd\b|th\b)(?!\s*:)(?:\s*(am|a\.m\.?|pm|p\.m\.?))?",
|
||||||
re.IGNORECASE,
|
re.IGNORECASE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user