From 07d80f689adaff4f6be1023316a34ebe6bf181d2 Mon Sep 17 00:00:00 2001 From: Holly McFarland Date: Sat, 29 Jan 2022 19:47:10 -0500 Subject: [PATCH] Allow curly braces in place of square brackets --- mtgcardlookup.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mtgcardlookup.py b/mtgcardlookup.py index 87c9fa3..3c4f450 100755 --- a/mtgcardlookup.py +++ b/mtgcardlookup.py @@ -235,7 +235,14 @@ async def handle_status(c, status): media_ids = None try: - card_names = re.findall(r'\[\[(.*?)\]\]', status_text) + card_names = re.findall( + r''' + (?:\[\[|\{\{) # A non-capturing group of the characters "[[" or "{{" + (.*?) # The card text being searched for (in a capturing group, so it's returned alone) + (?:\]\]|\}\}) # A non-capturing group of the characters "]]" or "}}" + ''', + status_text, + re.VERBOSE) # ignore any statuses without cards in them if not card_names: return