title: Regular expression to remove a file's extension
body: <p>I am in need of a regular expression that can remove the extension of a filename, returning only the name of the file.</p>
  
  <p>Here are some examples of inputs and outputs:</p>
  
  <pre><code>myfile.png     -&gt; myfile
  myfile.png.jpg -&gt; myfile.png
  </code></pre>
  
  <p>I can obviously do this manually (ie removing everything from the last dot) but I'm sure that there is a regular expression that can do this by itself.</p>
  
  <p><em>Just for the record, I am doing this in JavaScript</em></p>