From 9d3ea8e90dd64070f9f6680fcab01cb125589848 Mon Sep 17 00:00:00 2001 From: RyanHiggins <90987220+rhigginsDE@users.noreply.github.com> Date: Fri, 1 Dec 2023 23:56:54 +0100 Subject: [PATCH] Update get domain name --- ionos_dyndns.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ionos_dyndns.py b/ionos_dyndns.py index 424c7f1..ddabf3b 100644 --- a/ionos_dyndns.py +++ b/ionos_dyndns.py @@ -135,8 +135,10 @@ def main(): def get_domain_from_fqdn(fqdn): - regex = r"(?:(?:\w|-)+\.)+(\w+\.\w+)$" - return re.search(regex, fqdn, re.IGNORECASE).group(1) + # Place the hyphen at the start of the character class to avoid misinterpretation + regex = r"(?:(?:[\w-]+)\.)+([\w-]+\.\w+)$" + match = re.search(regex, fqdn, re.IGNORECASE) + return match.group(1) if match else None def get_ipv4_address():