Given a paragraph of text, how to get everything from the start to the last whitespace?
<p>Given a block of text like so: </p>

<pre><code>"Hello world this is http://yahoo.com "
</code></pre>

<p>On keypress I'm looking at the text for links. I don't want to look for links in text while the user is still typing, example: </p>

<pre><code>"Hello world this is http://yahoo.co"
</code></pre>

<p>How can I get everything in the text var starting from the left, 0, all the way to the last white space, meaning I don't get a url while the user is typing it?</p>

<p>Thanks</p>

<p><strong>UPDATED</strong></p>

<p>Typing <code>Hello world this is http://yahoo.com</code> should return <code>Hello world this is http://yahoo.com</code> </p>

<p>Typing <code>Hello world this is http://yahoo.co</code> should return <code>Hello world this is</code> </p>
