Does anyone have a regular expression handy that will match any legal DNS hostname or IP address?
It\'s easy to write one that works 95% of the time, but I\'m hoping
def isValidHostname(hostname): if len(hostname) > 255: return False if hostname[-1:] == ".": hostname = hostname[:-1] # strip exactly one dot from the right, # if present allowed = re.compile("(?!-)[A-Z\d-]{1,63}(?