title: regex expression for extracting a base file name from a path
body: <p>I would like to get the alphabetic parts of a file from some file paths.</p>
  
  <pre><code>files = ['data/Conversion/201406/MM_CLD_Conversion_Advertiser_96337_Daily_140606.zip', 
           'data/Match/201406/MM_CLD_Match_Advertiser_111423_Daily_140608.csv.zip', 
           'data/AQlog/201406/orx140605.csv.zip',
           'data/AQlog/201406/orx140605.csv.zip/']
  </code></pre>
  
  <p>Currently I do this:</p>
  
  <ol>
  <li>strip end slashes</li>
  <li>os.path.split()[1] to get filename</li>
  <li>two <code>os.path.splitext()</code> to remove a possible 2 file extensions</li>
  <li>lose the numbers</li>
  <li>lose the underscores</li>
  </ol>
  
  <p>Code:</p>
  
  <pre><code>for f in files:
      a = os.path.splitext(os.path.splitext(os.path.split(f.rstrip('/\\'))[1])[0])[0]
      b = re.sub('\d+', '', a).replace('_','')
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>'MMCLDConversionAdvertiserDaily'
  'MMCLDMatchAdvertiserDaily'
  'orx'
  'orx'
  </code></pre>
  
  <p>Is there a faster or more pythonic way, using a compiled regex function? Or is trying to use the library <code>os.path()</code> very reasonable? I also do not have to do this more than 100 times, so it's not a speed problem, this is just for clarity.</p>