From 558eabcccada4a83dd64bab04c9ae920bc30d146 Mon Sep 17 00:00:00 2001 From: Aadi Desai <21363892+supleed2@users.noreply.github.com> Date: Thu, 18 Nov 2021 22:17:36 +0000 Subject: [PATCH] Fix Regex term Should now only match when at the start of message or word --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index 0936713..6599330 100644 --- a/app.py +++ b/app.py @@ -28,7 +28,7 @@ async def on_message(message): else: global counter print("Message from " + message.author.name + ": " + message.content) - reply = re.split("I'm |Im |i'm |im |I am |i am ", message.content, 1) + reply = re.split("(^| )(I'm |Im |i'm |im |I am |i am )", message.content, 1) if len(reply) > 1: if counter > 0: counter -= 1