title: Javascript: Replace characters after _
body: <p>I'm trying to do something which seems fairly basic, but can't seem to get it working. </p>
  
  <p>I'm trying to strip the characters after the last instance of an underscore.</p>
  
  <p>I have this string, for example: </p>
  
  <p>www/images/10/20120412/28-696-b0b9815463e47c9371b02b7202788a75_tn.jpg</p>
  
  <p>and I'm trying to strip out the 'tn.jpg' to produce:</p>
  
  <p>www/images/10/20120412/28-696-b0b9815463e47c9371b02b7202788a75_</p>
  
  <p>I tried doing .slice(0,-6) but that will only work for instances of _tn.jpg and not _med.jpg.</p>
  
  <p>Ultimately, I'm going to be swapping in different sizes of images (_med.jpg, _full.jpg etc.) and it needs to be only after the last underscore (there might be underscores in the URL).</p>
  
  <p>Any help would be greatly appreciated! </p>
  
  <p>Zack</p>