private void updatePatternSubscription(Cluster cluster) {
        final Set<String> topicsToSubscribe = cluster.topics().stream()
                .filter(subscriptions::matchesSubscribedPattern)
                .collect(Collectors.toSet());
        if (subscriptions.subscribeFromPattern(topicsToSubscribe)) {
            applicationEventHandler.add(new SubscriptionChangeEvent());
            this.metadataVersionSnapshot = metadata.requestUpdateForNewTopics();
        }
    }
<p>

This function evaluates the regex that the consumer subscribed to
against the list of topic names from metadata, and updates
the list of topics in subscription state accordingly

@param cluster Cluster from which we get the topics
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java