diff --git a/telebot/util.py b/telebot/util.py index 21826d0..31d2d35 100644 --- a/telebot/util.py +++ b/telebot/util.py @@ -244,7 +244,7 @@ def extract_arguments(text): :param text: String to extract the arguments from a command :return: the arguments if `text` is a command (according to is_command), else None. """ - regexp = re.compile("/\w*(@\w*)*\s*([\s\S]*)",re.IGNORECASE) + regexp = re.compile(r"/\w*(@\w*)*\s*([\s\S]*)",re.IGNORECASE) result = regexp.match(text) return result.group(2) if is_command(text) else None diff --git a/tests/test_telebot.py b/tests/test_telebot.py index 101061f..5d324dd 100644 --- a/tests/test_telebot.py +++ b/tests/test_telebot.py @@ -48,7 +48,7 @@ class TestTeleBot: bot = telebot.TeleBot('') msg = self.create_text_message(r'https://web.telegram.org/') - @bot.message_handler(regexp='((https?):((//)|(\\\\))+([\w\d:#@%/;$()~_?\+-=\\\.&](#!)?)*)') + @bot.message_handler(regexp=r'((https?):((//)|(\\\\))+([\w\d:#@%/;$()~_?\+-=\\\.&](#!)?)*)') def command_url(message): msg.text = 'got' @@ -84,7 +84,7 @@ class TestTeleBot: bot = telebot.TeleBot('') msg = self.create_text_message(r'web.telegram.org/') - @bot.message_handler(regexp='((https?):((//)|(\\\\))+([\w\d:#@%/;$()~_?\+-=\\\.&](#!)?)*)') + @bot.message_handler(regexp=r'((https?):((//)|(\\\\))+([\w\d:#@%/;$()~_?\+-=\\\.&](#!)?)*)') def command_url(message): msg.text = 'got'