Merge pull request #5 from rhigginsDE/main
Update def get_domain_from_fqdn(fqdn)
This commit is contained in:
commit
532dcad35b
1 changed files with 4 additions and 2 deletions
|
@ -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():
|
||||
|
|
Loading…
Reference in a new issue