views:

438

answers:

2

Is it possible using the Twitter API to retrieve a list of all hashtags present within a single tweet?

For example, let's say I have a tweet (let's say it has an ID of 12345) with the following text:

Hi. I love #stackoverflow because it's #superawesome. #fb

Is there an API call that will give me back #stackoverflow, #superawesome, & #fb when I give it an ID of 12345?

Or do I just have to parse the text of the tweet myself?

+1  A: 

The Twitter API does not have any functions specifically designed for hashtags. You'll need to parse the text on your own.

ahockley
+4  A: 

You'll have to use a regular expression in your language of choice

   #\S+

should match any hash, beginning with # and made of a string of characters. It stops at the first space.

If you want to exclude any trailing symbol and have a letter as the last char :

#\S*\w

This expression should work in most of the regex engines I'm aware of.

Yann Schwartz

related questions