Rewrite regex

This commit is contained in:
monosans
2022-06-21 13:13:47 +03:00
parent e0c1dc2ef4
commit 2fba31c06a
+15 -5
View File
@@ -150,11 +150,21 @@ class ProxyScraperChecker:
if not self.enabled_folders:
raise ValueError("all folders are disabled in the config")
regex = r"(?:^|\D)?(({0}\.{1}\.{1}\.{1}):{2})(?:\D|$)".format(
r"(?:[1-9]|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])", # 1-255
r"(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])", # 0-255
r"(?:\d|[1-9]\d{1,3}|[1-5]\d{4}|6[0-4]\d{3}"
+ r"|65[0-4]\d{2}|655[0-2]\d|6553[0-5])", # 0-65535
regex = (
r"(?:^|\D)?(("
+ r"(?:[1-9]|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])" # 1-255
+ r"\."
+ r"(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])" # 0-255
+ r"\."
+ r"(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])" # 0-255
+ r"\."
+ r"(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])" # 0-255
+ r"):"
+ (
r"(?:\d|[1-9]\d{1,3}|[1-5]\d{4}|6[0-4]\d{3}"
+ r"|65[0-4]\d{2}|655[0-2]\d|6553[0-5])"
) # 0-65535
+ r")(?:\D|$)"
)
self.regex = re.compile(regex)