I'm detecting @replies in a Twitter stream with the following PHP code using regexes.
$text = preg_replace('!^@([A-Za-z0-9_]+)!', '<a href="http://twitter.com/$1" target="_blank">@$1</a>', $text);
$text = preg_replace('! @([A-Za-z0-9_]+)!', ' <a href="http://twitter.com/$1" target="_blank">@$1</a>', $text);
How can I best combine these two rules without false flagging [email protected] as a reply?