title: regex help - finding everything until the previous space character
body: <p>I'm trying to figure out regular expressions and am having trouble parsing the following.</p>
  
  <p>I have several hundred lines that look like so:</p>
  
  <pre><code>source ~/.bashrc; cd ~/myfiles/Clustering/Code/Connectedness/Code; R CMD BATCH "--vanilla --args BRAF P15056 BRAF_P15056_MutationOutput.txt 3NY5.pdb A"  MutationAnalysisRunMeAlignment.R ~/myfiles/Clustering/ROutput/RunOutputAlignment/BRAF_P15056_3NY5_A_RunResults.txt
  </code></pre>
  
  <p>I want to find the part of the string that ends with "MutationOutput.txt" and match it up to  the previous space. I then want to replace it with nothing. Thus the above line would become:</p>
  
  <pre><code>source ~/.bashrc; cd ~/myfiles/Clustering/Code/Connectedness/Code; R CMD BATCH "--vanilla --args BRAF P15056 3NY5.pdb A"  MutationAnalysisRunMeAlignment.R ~/myfiles/Clustering/ROutput/RunOutputAlignment/BRAF_P15056_3NY5_A_RunResults.txt
  </code></pre>
  
  <p>I know it needs to be something like this, </p>
  
  <pre><code>[A-Z_0-9]MutationOutput.txt
  </code></pre>
  
  <p>but how that only captures the final part of the line: "_MutationOutput.txt". How do I make it count everything until the previous space character?</p>
  
  <p>Thank you for your help!</p>