Use a default regex when possible (#205)

This commit is contained in:
Marc Wrobel
2023-12-01 21:08:11 +01:00
parent e97e261946
commit 750faaa64f
10 changed files with 20 additions and 35 deletions

View File

@@ -3,7 +3,6 @@ import re
from common import endoflife
URL = "https://www.unrealircd.org/docwiki/index.php?title=History_of_UnrealIRCd_releases&action=raw"
REGEX = r"^(?:(\d+\.(?:\d+\.)*\d+))$"
print("::group::unrealircd")
response = endoflife.fetch_url(URL)
@@ -14,7 +13,7 @@ for tr in wikicode.ifilter_tags(matches=lambda node: node.tag == "tr"):
items = tr.contents.filter_tags(matches=lambda node: node.tag == "td")
if len(items) >= 2:
maybe_version = items[0].__strip__()
if re.match(REGEX, maybe_version):
if re.match(endoflife.DEFAULT_VERSION_REGEX, maybe_version):
maybe_date = items[1].__strip__()
if re.match(r"\d{4}-\d{2}-\d{2}", maybe_date):
versions[maybe_version] = maybe_date