Hey Leon -
There's code at the link below that has worked for me in the past. I
have since re-written it in JavaScript (using the same regular
expressions) as I'm now 'building' tweets for display on the client
side - but the expressions still work even in JS
If you include the parameter include_entities=1 in your request we will
return an extra object in the response telling you where the hashtags,
mentions and URLs are in the Tweet.
You can learn more about Tweet Entities on our developer resources site: