title: R: extract part of a filename
body: <p>I'm trying to extract part of a filename using R, I have a vague idea about how to go about this from here: <a href="https://stackoverflow.com/questions/17055152/extract-part-of-a-file-name-in-r">extract part of a file name in R</a>
  however I can't quite get this to work on my list of filenames</p>
  
  <p>example of filenames:</p>
  
  <pre><code>"Species Count (2011-12-15-07-09-39).xls"
  "Species Count 0511.xls"
  "Species Count 151112.xls" 
  "Species Count1011.xls" 
  "Species Count2012-01.xls" 
  "Species Count201207.xls" 
  "Species Count2013-01-15.xls"  
  </code></pre>
  
  <p>Some of the filenames have a space between Species Count and the date, some without a space, and they are of different lengths and some contain brackets. I just want to extract the numerical part of the filename and to keep the -'s aswell. So for example for the data above I would have:</p>
  
  <p><b> Expected output: </b></p>
  
  <pre><code>2011-12-15-07-09-39 , 0511 , 151112 , 1011 , 2012-01 , 201207 , 2013-01-15
  </code></pre>