Blizzard / node-rdkafka

Node.js bindings for librdkafka
MIT License
2.1k stars 390 forks source link

QUESTION: what format is as regex allowed in topic.blacklist #1028

Open UglyBarnacle opened 1 year ago

UglyBarnacle commented 1 year ago

Environment Information

node-rdkafka Configuration Settings I am trying to blacklist all the topics that a consumer is not subscribed to for readability and debug purposes with the topic.blacklist option, but are unable to get it to run because I always end up with an Error

Error: Failed to parse pattern "^(?!.*not\.endswith\.topic$).*": repetition-operator operand invalid at KafkaConsumer.Client (/System/Volumes/Data/workspace/myservice/node_modules/node-rdkafka/lib/client.js:54:18)

I am trying to exclude all topics from metadata that do not end with the current assigned topic(s). for example:

Pattern: ^(?!.*not\.endswith\.topic$).*$

does.not.endswith.topic    // no match
not.endswith.topic         // no match
this.is.another.topic      // match
something                  // match
else                       // match

I tried a negative lookbehind, negative lookahead, but none works, always the same exception. Am I just too basic for regex? or do I have to be aware what type of regex I can use because the underlying lib is a C lib?

Additional context image