public static 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;
        }

        Matcher matcher = domainRegex.matcher(domain);
        if (matcher.matches()) {
            int count = matcher.groupCount();
            String[] groups = new String[count];
            for (int j = 0; j < count; j++) {
                groups[j] = matcher.group(j + 1);
            }
            return isValidTld(groups[0]);
        }

        return false;
    }
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
core/src/main/java/com/alibaba/fastjson2/schema/DomainValidator.java