librdkafka
librdkafka copied to clipboard
Regex support Negative Lookahead
Description
I am trying to consume topic's using regex ^nginx.(?!svc$|nginx$|.*sandbox).*
and getting Local: Invalid argument or configuration (invalid_arg)
. How could I solve this issue? And seems I was not able to find anything useful abour regex in documentation.
How to reproduce
use ^nginx.(?!svc$|nginx$|.*sandbox).*
as topic name
IMPORTANT: Always try to reproduce the issue on the latest released version (see https://github.com/edenhill/librdkafka/releases), if it can't be reproduced on the latest version the issue has been fixed.
Checklist
IMPORTANT: We will close issues where the checklist has not been completed.
Please provide the following information:
- [x] librdkafka version (release number or git tag):
<REPLACE with e.g., v0.10.5 or a git sha. NOT "latest" or "current">
- [ ] Apache Kafka version:
<REPLACE with e.g., 0.10.2.3>
- [ ] librdkafka client configuration:
<REPLACE with e.g., message.timeout.ms=123, auto.reset.offset=earliest, ..>
- [ ] Operating system:
<REPLACE with e.g., Centos 5 (x64)>
- [ ] Provide logs (with
debug=..
as necessary) from librdkafka - [ ] Provide broker log excerpts
- [ ] Critical issue
In depends on how it is compiled, but per https://github.com/edenhill/librdkafka/blob/f092c290995ca81b3afb4015fcc3350ba02caa96/src/rdregex.c#L72 librdkafka uses internally POSIX extended regular expressions. These are limited compared to PCREs and do not support lookahead/backreferences/etc.
You can use topic.blacklist
to filter out topics that the client should not see at all.