From 9ff57748d16e97b5a6ac8afa20ef425a720da600 Mon Sep 17 00:00:00 2001 From: Citation Checking Project Date: Thu, 9 Jul 2020 14:40:50 +0000 Subject: [PATCH] avoid greedy regexes --- analyze.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/analyze.py b/analyze.py index 1027916..6ad012e 100755 --- a/analyze.py +++ b/analyze.py @@ -55,9 +55,9 @@ class GiftedSubscription(Subscription): PATTERNS = [re.compile(r) for r in ( - r'\[(?P.*)\] Broadcast: (?P\w+) has donated \$(?P.+)!', - r'\[(?P.*)\] Broadcast: (?P\w+) got a Tier (?P\d)', - r'\[(?P.*)\] Broadcast: (?P\w+) gave (?P\w+) a Tier (?P\d)', + r'\[(?P.*?)\] Broadcast: (?P\w+) has donated \$(?P.+?)!', + r'\[(?P.*?)\] Broadcast: (?P\w+) got a Tier (?P\d)', + r'\[(?P.*?)\] Broadcast: (?P\w+) gave (?P\w+) a Tier (?P\d)', )] def parse_donations(lines: Iterable[str]) -> Iterable[Donation]: