From 141b620437aab660aabcb7bff521c4af5c3852e1 Mon Sep 17 00:00:00 2001 From: Nick80835 <24271245+Nick80835@users.noreply.github.com> Date: Wed, 5 Feb 2025 05:35:10 -0500 Subject: [PATCH] Make markdown URL regex less greedy Fixes multiple URLs in a single message. --- telethon/extensions/markdown.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telethon/extensions/markdown.py b/telethon/extensions/markdown.py index 0a0e3291..032f7eef 100644 --- a/telethon/extensions/markdown.py +++ b/telethon/extensions/markdown.py @@ -22,7 +22,7 @@ DEFAULT_DELIMITERS = { '```': MessageEntityPre } -DEFAULT_URL_RE = re.compile(r'\[([\s\S]+)\]\((.+)\)') +DEFAULT_URL_RE = re.compile(r'\[([\s\S]+?)\]\((.+?)\)') DEFAULT_URL_FORMAT = '[{0}]({1})'