[Java] Check UUID format

Ref. BUKKIT: Best way to check if a String is a UUID

    private static boolean checkUUIDFromat(String uuid) {
        if (uuid.matches("[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}")) {
            return true;
        }
        return false;
    }
This entry was posted in Java. Bookmark the permalink.