title: Regular Expression to select everything before and up to a particular text
body: <p>I am trying to use a regular expression to find a part of a string and select everything up to that string.  So for example if my string is <code>this/is/just.some/test.txt/some/other</code>, I want to search for <code>.txt</code> and when I find it select everything before and up to <code>.txt</code>.</p>