public TopicPartitionFilter createTopicPartitionFilterWithTopicAndPartitionPattern(String topicOpt, String partitionIds) throws TerseException {
        return new TopicFilterAndPartitionFilter(
                new IncludeList(topicOpt != null ? topicOpt : ".*"),
                new PartitionsSetFilter(createPartitionSet(partitionIds))
        );
    }
Creates a topic-partition filter based on a topic pattern and a set of partition ids.
tools/src/main/java/org/apache/kafka/tools/GetOffsetShell.java