A method using regexp and php. Actually what this does is parse Tweets using regexp to reformat the text as html with links. A tutorial here:
http://saturnboy.com/2010/02/parsing-twitter-with-regexp/
This is a php library that breaks out hashtags, usernames, etc., but doesn’t really provide a way to isolate the remaining stuff. I have put it in tkzic/API – there is an example php program provided.
https://github.com/mzsanford/twitter-text-php
hashtags – using regular expressions
http://stackoverflow.com/questions/11551065/parsing-tweets-to-extract-hashtags-in-r
twitter-text-rb : ruby gem which parses out usernames and hashtags
https://github.com/twitter/twitter-text-rb