title: Listing files in a directory, where the filename matches a regex in JS
body: <p>I want to get all filenames within a directory that follow a specific pattern. I found out, that I can accomplish this by doing the following:</p>
  
  <pre><code>var fs = require('fs');
  
  fs.readdir( dir, function(err, list) {
      if(err)
          throw err;
      var regex = new RegExp(".*");
      list.forEach( function(item) {
      if( regex.test(item) ) 
         console.log(item);
      }); 
  });
  </code></pre>
  
  <p>I was wondering, if there is another possibility to do this without using a loop, e.g. passing a regex to <code>fs.readdir(..)</code>.<br/>
  Is that somehow possible, or do I have to use a loop?</p>