title: R regex: How to extract string with one or two digit number within title?
body: <p>I have a bunch of filenames that are numbered that I would like to be able to extract based on a regex statement.</p>
  
  <p>For example, say I have the following filenames:</p>
  
  <p><code>file.names &lt;- paste0("run", 0:99, ".dat.gz")</code></p>
  
  <p>If I wanted to extract files 5 through 8, I would need a regex that returns the following:</p>
  
  <pre><code>grep("correct_regex", file.names, value=TRUE)
  "run5.dat.gz"  "run6.dat.gz"  "run7.dat.gz"  "run8.dat.gz"
  </code></pre>
  
  <p>Or if I wanted to return files 9 through 21, it would return the following:</p>
  
  <pre><code>grep("correct_regex", file.names, value=TRUE)
  "run9.dat.gz"  "run10.dat.gz" "run11.dat.gz" "run12.dat.gz" "run13.dat.gz" "run14.dat.gz" "run15.dat.gz" "run16.dat.gz" "run17.dat.gz" "run18.dat.gz" "run19.dat.gz" "run20.dat.gz" "run21.dat.gz"
  </code></pre>
  
  <p>The tricky part if developing a regex that extracts the number as opposed to the digits (e.g. <code>[0-9]</code>). Any tips to help with this?</p>