title: Php to replace @username with link to twitter account
body: <p>I assume this is some to do with regex, but it's an art all it's own - and I need some help.</p>
  
  <p>When we display a story, we store all the text in a varilable - let's say $story. </p>
  
  <p>What i'd like is to do a str_replace (I think that's what I need) that says something like this "If the text contains @something then turn it into a link like <code>&lt;a href="http://www.twitter.com/something"&gt;@something&lt;/a&gt;</code>- but only do this if there's nothing before the @ symbol" (to exclude email addresses)</p>
  
  <p>Also, we'd need to stop the 'something' if there's a space or punctuation after it. so that @something. doesn't turn into <code>&lt;a href="http://www.twitter.com/something."&gt;@something.&lt;/a&gt;</code></p>
  
  <p>Any suggestions on how to make this work?</p>