Merge pull request #90 from SillyLossy/regexp

Escape regexp in message extraction
This commit is contained in:
oobabooga 2023-02-19 08:31:19 -03:00 committed by GitHub
commit c92f347c94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: