How to find regexp in a string and attach it to a variable
<p>Let's say we have a string in JavaScript "This is a nice website - <a href="http://stackoverflow.com">http://stackoverflow.com</a>". I want to extract the URL along with the three preceding characters (space dash space) using RegExp and attach the extracted string to a variable.</p>

<p>var string = "This is a nice website - <a href="http://stackoverflow.com">http://stackoverflow.com</a>";</p>

<p>var reg = ""; //no idea how to write this regexp for extracting url and three preceding chars</p>

<p>// and after some magic I would get</p>

<p>var extracedString = " - <a href="http://www.stackoverflow.com">http://www.stackoverflow.com</a>";</p>

<p>Anyone? Thanks.</p>
