From 1946393c36d64511f691595e9625718049fafcca Mon Sep 17 00:00:00 2001 From: Artin GH <80193492+Artin-GH@users.noreply.github.com> Date: Fri, 14 Jul 2023 16:39:50 +0330 Subject: [PATCH] Fix backslash (\) issue in escape_markdown --- telebot/formatting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telebot/formatting.py b/telebot/formatting.py index ec421c6..32a09fe 100644 --- a/telebot/formatting.py +++ b/telebot/formatting.py @@ -61,8 +61,8 @@ def escape_markdown(content: str) -> str: :rtype: :obj:`str` """ - parse = re.sub(r"([_*\[\]()~`>\#\+\-=|\.!\{\}])", r"\\\1", content) - reparse = re.sub(r"\\\\([_*\[\]()~`>\#\+\-=|\.!\{\}])", r"\1", parse) + parse = re.sub(r"([_*\[\]()~`>\#\+\-=|\.!\{\}\\])", r"\\\1", content) + reparse = re.sub(r"\\\\([_*\[\]()~`>\#\+\-=|\.!\{\}\\])", r"\1", parse) return reparse