For my stock-market chat I want to replace every specific string pattern to html code. For example if I type "b $goog 780" i want this string to be replaced with:
Buy <a href="/stocks/goog">$goog</a> at 780
How can I do this specific task with preg_replace?