From 6d3048a6e442df29847783d1d7565d92cefd6689 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Thu, 9 Aug 2012 15:48:03 -0400 Subject: [PATCH] Improve regex for matching signatures. --- earwigbot/tasks/drn_clerkbot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/earwigbot/tasks/drn_clerkbot.py b/earwigbot/tasks/drn_clerkbot.py index ec777a0..9ee7cf9 100644 --- a/earwigbot/tasks/drn_clerkbot.py +++ b/earwigbot/tasks/drn_clerkbot.py @@ -456,9 +456,9 @@ class DRNClerkBot(Task): Signatures are returned as tuples of (editor, timestamp as datetime). """ - regex = r"\[\[(?:User(?:\stalk)?\:|Special\:Contributions\/)" + regex = r"\[\[(?:[uU]ser(?:\stalk)?\:|[sS]pecial\:[cC]ontributions\/)" regex += r"([^\n\[\]|]{,256}?)(?:\||\]\])" - regex += r"(?!.*?(?:User(?:\stalk)?\:|Special\:Contributions\/).*?)" + regex += r"(?!.*?(?:[uU]ser(?:\stalk)?\:|[sS]pecial\:[cC]ontributions\/).*?)" regex += r".{,256}?(\d{2}:\d{2},\s\d{1,2}\s\w+\s\d{4}\s\(UTC\))" matches = re.findall(regex, text, re.U) signatures = []