title: Regex: Get Filename Without Extension in One Shot?
body: <p>I want to get just the filename using regex, so I've been trying simple things like</p>
  
  <pre><code>([^\.]*)
  </code></pre>
  
  <p>which of course work only if the filename has one extension. But if it is <code>adfadsfads.blah.txt</code> I just want <code>adfadsfads.blah</code>. How can I do this with regex?</p>
  
  <p>In regards to David's question, 'why would you use regex' for this, the answer is, 'for fun.' In fact, the code I'm using is simple</p>
  
  <pre><code>length_of_ext = File.extname(filename).length
  filename = filename[0,(filename.length-length_of_ext)]
  </code></pre>
  
  <p>but I like to learn regex whenever possible because it always comes up at Geek cocktail parties.</p>