瀏覽代碼

Improve regex for matching signatures.

tags/v0.1^2
Ben Kurtovic 12 年之前
父節點
當前提交
6d3048a6e4
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. +2
    -2
      earwigbot/tasks/drn_clerkbot.py

+ 2
- 2
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 = []


Loading…
取消
儲存