Turn a twitter hash tag into a link and links to clickable links
<p>Im creating a list of Twitter results in PHP, im already using PHP to turn text links in the string returned into clickable links rather than plain text.</p>

<p>In some of the Twitter results the string contains hash tags, simply text prepended with the # character.</p>

<p>What i would like to do is take the hastag and convert it into a clickable link.</p>

<p>For instance:</p>

<pre><code>Hello my name is Dan, and im working with the #twitter api
</code></pre>

<p>Which I want to turn into:</p>

<pre><code>Hello my name is Dan, and im working with the &lt;a href="http://search.twitter.com/search?q=%23twitter"&gt;#twitter&lt;/a&gt; api
</code></pre>

<p>Notice that in the URL I have to change the # to %23 - I think encode or decode.</p>

<p>Also....</p>

<p>Im already using the following code to create clickable links within the string, is it possible to combine the two RegEx's?</p>

<p>Here is my PHP to convert links to clickable links:</p>

<pre><code>            //Convert links in string to links
            preg_match('/(http:\/\/[^\s]+)/', $row["content"], $text);
            $hypertext = "&lt;a target='_blank' href=\"". $text[0] . "\"&gt;" . $text[0] . "&lt;/a&gt;";
            $newString = preg_replace('/(http:\/\/[^\s]+)/', $hypertext, $row["content"]);
</code></pre>
