From ded890c378158d65d5bac8a7a23aa7200d8c77b8 Mon Sep 17 00:00:00 2001 From: SillyLossy Date: Sun, 19 Feb 2023 12:52:18 +0200 Subject: [PATCH] Escape regexp in message extraction --- server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.py b/server.py index 04b2c7e3..17f1a378 100644 --- a/server.py +++ b/server.py @@ -559,8 +559,8 @@ def extract_message_from_reply(question, reply, current, other, check, extension next_character_found = False substring_found = False - previous_idx = [m.start() for m in re.finditer(f"(^|\n){current}:", question)] - idx = [m.start() for m in re.finditer(f"(^|\n){current}:", reply)] + previous_idx = [m.start() for m in re.finditer(f"(^|\n){re.escape(current)}:", question)] + idx = [m.start() for m in re.finditer(f"(^|\n){re.escape(current)}:", reply)] idx = idx[len(previous_idx)-1] if extensions: