From c5e733a4c14d9e17c5e37acc46129b10556025e4 Mon Sep 17 00:00:00 2001 From: _run Date: Tue, 20 Dec 2022 23:47:12 +0400 Subject: [PATCH] Escape both metachars --- telebot/formatting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telebot/formatting.py b/telebot/formatting.py index 4af8263..ec421c6 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