From f0640ada291df82394f02eb544d51c9320d111f6 Mon Sep 17 00:00:00 2001 From: Masato Ikeda Date: Fri, 27 Apr 2018 18:26:08 +0900 Subject: [PATCH] Improve regex Match eather `-` or `.` but not both at the same time. --- src/nip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nip.py b/src/nip.py index 7639adc..e096b30 100755 --- a/src/nip.py +++ b/src/nip.py @@ -131,7 +131,7 @@ class DynamicBackend: def handle_subdomains(self, qname): subdomain = qname[0:qname.find(self.domain) - 1] - match = re.findall('^(?:.+\.)?(\d{1,3}[-.]\d{1,3}[-.]\d{1,3}[-.]\d{1,3})$', subdomain) + match = re.findall('^(?:.+\.)?(\d{1,3}([-.])\d{1,3}\2\d{1,3}\2\d{1,3})$', subdomain) if not match: if DEBUG: