Retrieve all hashtags from a tweet

后端 未结 4 1707
情歌与酒
情歌与酒 2021-01-15 10:26

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 I

4条回答
  •  攒了一身酷
    2021-01-15 11:03

    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.

提交回复
热议问题