[
https://issues.apache.org/jira/browse/KAFKA-20642?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jheng-Sing Chen updated KAFKA-20642:
------------------------------------
Description:
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.
TODO Link:
(https://github.com/apache/kafka/blob/f2f31100c4b7aef96a86e77d5ecf47ef7f9f3468/shell/src/main/java/org/apache/kafka/shell/glob/GlobComponent.java#L110)
was:
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.
> 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
> Priority: Minor
>
> 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.
> TODO Link:
> (https://github.com/apache/kafka/blob/f2f31100c4b7aef96a86e77d5ecf47ef7f9f3468/shell/src/main/java/org/apache/kafka/shell/glob/GlobComponent.java#L110)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)