Jheng-Sing Chen created KAFKA-20642:
---------------------------------------

             Summary: Support character ranges in Kafka shell globs
                 Key: KAFKA-20642
                 URL: https://issues.apache.org/jira/browse/KAFKA-20642
             Project: Kafka
          Issue Type: Improvement
          Components: tools
            Reporter: Jheng-Sing Chen
            Assignee: Jheng-Sing Chen


Kafka shell glob matching currently supports `*`, `?`, and `\{a,b}` groups in 
GlobComponent, but character classes/ranges are not implemented.

GlobComponent.java contains a TODO for this:

  // TODO: handle character ranges

As a result, glob patterns such as:

  topic-[0-9]
  topic-[abc]
  topic-[!abc]

are not interpreted as character classes/ranges.

Expected behavior:

  topic-[0-9] should match topic-0, topic-1, ..., topic-9
  topic-[0-9] should not match topic-a or topic-10
  topic-[abc] should match topic-a, topic-b, and topic-c
  topic-[!abc] should match a single character other than a, b, or c

This can likely be addressed in org.apache.kafka.shell.glob.GlobComponent by 
translating glob character classes into equivalent Java regular expression 
character classes, with tests added to GlobComponentTest.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to