DEV Community

Samuel Suther
Samuel Suther

Posted on

Regular Expression to find hastag-cloud at the end of an message

Alt Text

I do support a Project named Facebook Newsbeamer, which do fetch your messages from your Facebook-Thread (via FB-API) and show in your News-Section at your Homepage.

As you might know, you can use hashtags (like #myHastag) in Facebook to make people easily find your post.
Some people do insert their hashtags right in the content, other ones put them all at the bottom of the message to provide a better readability of the message.

I do call those "all hastags at the bottom of the message" - hastag-cloud.

As we don't need the hashtag-cloud in our Newsboard at our Website, we decide to locate them, and cut them of.

How I did it

And here is how I did it.
We do fetch the messages via PHP ⇒ FB-API. So I've created a Regular-Expression which does the job!

https://regexr.com/62fbp

So as this might also be usefull for other ones, I do share it here.
Feel free to use and share it for free.

Top comments (0)