synchronized boolean matchesSubscribedPattern(String topic) {
        Pattern pattern = this.subscribedPattern;
        if (hasPatternSubscription() && pattern != null)
            return pattern.matcher(topic).matches();
        return false;
    }
Check whether a topic matches a subscribed pattern.

@return true if pattern subscription is in use and the topic matches the subscribed pattern, false otherwise
clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java