private static boolean containsValidPattern(final String topic) {
        for (int i = 0; i < topic.length(); ++i) {
            final char c = topic.charAt(i);

            // We don't use Character.isLetterOrDigit(c) because it's slower
            final boolean validLetterOrDigit = (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z');
            final boolean validChar = validLetterOrDigit || c == '.' || c == '_' || c == '-';
            if (!validChar) {
                return false;
            }
        }
        return true;
    }
Valid characters for Kafka topics are the ASCII alphanumerics, '.', '_', and '-'
streams/src/main/java/org/apache/kafka/streams/kstream/Named.java