Update get domain name
This commit is contained in:
parent
6c090ab928
commit
9d3ea8e90d
1 changed files with 4 additions and 2 deletions
|
@ -135,8 +135,10 @@ def main():
|
||||||
|
|
||||||
|
|
||||||
def get_domain_from_fqdn(fqdn):
|
def get_domain_from_fqdn(fqdn):
|
||||||
regex = r"(?:(?:\w|-)+\.)+(\w+\.\w+)$"
|
# Place the hyphen at the start of the character class to avoid misinterpretation
|
||||||
return re.search(regex, fqdn, re.IGNORECASE).group(1)
|
regex = r"(?:(?:[\w-]+)\.)+([\w-]+\.\w+)$"
|
||||||
|
match = re.search(regex, fqdn, re.IGNORECASE)
|
||||||
|
return match.group(1) if match else None
|
||||||
|
|
||||||
|
|
||||||
def get_ipv4_address():
|
def get_ipv4_address():
|
||||||
|
|
Loading…
Reference in a new issue