title: PHP rdkafka. How to consume topic matching regular expression?
body: <p>I can consume messages from Kafka, only if I specify topics with their strict name, like 'some_topic', but I wnat to consume topics which match a particular regular expression:</p>
  
  <pre><code>&lt;?php
  
  $conf = new RdKafka\Conf();
  //$conf-&gt;set('log_level', 1);
  //$conf-&gt;set('debug', 'all');
  $rk = new RdKafka\Consumer($conf);
  $rk-&gt;addBrokers("localhost:9092");
  
  $topic = $rk-&gt;newTopic("^postgres.public.table_[0-9]+_");
  
  $topic-&gt;consumeStart(0, RD_KAFKA_OFFSET_BEGINNING);
  
  while (true) {
      $msg = $topic-&gt;consume(0, 1000);
      if (null === $msg || $msg-&gt;err === RD_KAFKA_RESP_ERR__PARTITION_EOF) {
          continue;
      } elseif ($msg-&gt;err) {
          echo $msg-&gt;errstr(), "\n";
          break;
      } else {
         echo $msg-&gt;payload;
          echo "\n\n";
      }
  }
  </code></pre>
  
  <p>As you can see the topic name is <code>^postgres.public.table_[0-9]+_</code>. However, it does not work. I get these error messages in the console:</p>
  
  <pre><code>%3|1579347443.452|ERROR|rdkafka#consumer-1| [thrd:app]: rdkafka#consumer-1: ^postgres.public.object_[0-9]+_ [0]: topic does not exist (Broker: Invalid topic)
  </code></pre>
  
  <p>What is wrong with that and how can I fix it?</p>