From 5c12f22a1f70feff1159dee47c61d673bc8ba5bd Mon Sep 17 00:00:00 2001 From: Ankur Oberoi Date: Mon, 29 Jan 2018 20:06:01 -0800 Subject: [PATCH] makes username regex capture group non-greedy, fixes #150 --- content/posts/160604-build-first-slack-bot-python.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/posts/160604-build-first-slack-bot-python.markdown b/content/posts/160604-build-first-slack-bot-python.markdown index b50e3e789..40f7e6578 100644 --- a/content/posts/160604-build-first-slack-bot-python.markdown +++ b/content/posts/160604-build-first-slack-bot-python.markdown @@ -128,7 +128,7 @@ variable values and then instantiate the Slack client. # constants RTM_READ_DELAY = 1 # 1 second delay between reading from RTM EXAMPLE_COMMAND = "do" - MENTION_REGEX = "^<@(|[WU].+)>(.*)" + MENTION_REGEX = "^<@(|[WU].+?)>(.*)" The code instantiates the `SlackClient` client with our `SLACK_BOT_TOKEN` @@ -263,7 +263,7 @@ starterbot_id = None # constants RTM_READ_DELAY = 1 # 1 second delay between reading from RTM EXAMPLE_COMMAND = "do" -MENTION_REGEX = "^<@(|[WU].+)>(.*)" +MENTION_REGEX = "^<@(|[WU].+?)>(.*)" def parse_bot_commands(slack_events): """