title: regex removing filename from path
body: <p>How could I design a RegEx script which would remove a filename from a path? The trick is, the paths have all sorts of wrenches to throw into the works.</p>
  
  <p>Paths can consist of:</p>
  
  <pre><code>1: "Folder1/Folder2/Folder3.1234/folder4.5678/ApplesandOranges.txt","MoreInfo","EvenMoreInfo"
  2: "Folder1/Folder2/Folder3.1234/folder4.91011/","MoreInfo","EvenMoreInfo"
  </code></pre>
  
  <p>or even</p>
  
  <pre><code>3: "Folder1/Folder2/Folder3.1234/folder4.5678/ApplesandOranges.zip?CatsAndDogs.txt","MoreInfo","EvenMoreInfo"
  </code></pre>
  
  <p>In cases 1 and 3, I'd like to end up with:</p>
  
  <pre><code>Folder1/Folder2/Folder3.1234/folder4.5678/
  </code></pre>
  
  <p>though, it would be acceptable for the second to return as </p>
  
  <pre><code>Folder1/Folder2/Folder3.1234/folder4.5678/ApplesandOranges.zip
  </code></pre>
  
  <p>though not preferred.</p>
  
  <p>In case 2, it'd just skip that line entirely as there is no filename.</p>
  
  <p>Any suggestions?</p>
  
  <p>Using standard RegEx via a text editor. No java use and such.</p>
  
  <p>Note: The path is just an example. There could be 50 folders. It's not a mere 4 folders all of the time</p>