public boolean isValid(String domain) {
        if (domain == null) {
            return false;
        }
        domain = unicodeToASCII(domain);
        // hosts must be equally reachable via punycode and Unicode;
        // Unicode is never shorter than punycode, so check punycode
        // if domain did not convert, then it will be caught by ASCII
        // checks in the regexes below
        if (domain.length() > 253) {
            return false;
        }
        String[] groups = domainRegex.match(domain);
        if (groups != null && groups.length > 0) {
            return isValidTld(groups[0]);
        }
        return allowLocal && hostnameRegex.isValid(domain);
    }
public boolean isValid(String domain) {
        if (domain == null) {
            return false;
        }
        domain = unicodeToASCII(domain);
        
        
        
        
        if (domain.length() > 253) {
            return false;
        }
        String[] groups = domainRegex.match(domain);
        if (groups != null && groups.length > 0) {
            return isValidTld(groups[0]);
        }
        return allowLocal && hostnameRegex.isValid(domain);
    }
public boolean isValid ( String domain ) { if ( domain == null ) { return false ; } domain = unicodeToASCII ( domain ) ; // hosts must be equally reachable via punycode and Unicode; // Unicode is never shorter than punycode, so check punycode // if domain did not convert, then it will be caught by ASCII // checks in the regexes below if ( domain . length ( ) > 253 ) { return false ; } String [ ] groups = domainRegex . match ( domain ) ; if ( groups != null && groups . length > 0 ) { return isValidTld ( groups [ 0 ] ) ; } return allowLocal && hostnameRegex . isValid ( domain ) ; }
Returns true if the specified <code>String</code> parses
as a valid domain name with a recognized top-level domain.
The parsing is case-insensitive.
@param domain the parameter to check for domain name syntax
@return true if the parameter is a valid domain name
Returns true if the specified <code > String< / code > parses as a valid domain name with a recognized top - level domain . The parsing is case - insensitive .