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.

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay