title: Select columns of data.table based on regex
body: <p>How can I select columns of a data.table based on a regex?
  Consider a simple example as follows:</p>
  
  
  
  <pre class="lang-r prettyprint-override"><code>library(data.table)
  mydt &lt;- data.table(foo=c(1,2), bar=c(2,3), baz=c(3,4))
  </code></pre>
  
  <p>Is there a way to use columns of <code>bar</code> and <code>baz</code> from the datatable based on a regex? I know that the following solution works but if the table is much bigger and I would like to choose more variables this could easily get cumbersome.</p>
  
  <pre class="lang-r prettyprint-override"><code>mydt[, .(bar, baz)]
  </code></pre>
  
  <p>I would like to have something like <code>matches()</code> in <code>dplyr::select()</code> but only by reference.</p>