How do I extract #hashtags from texts saved in SQL? Or directly extract #hashtag and show them as clickables in search bar "drop-down like thing"?
For example
text1 = "This is a nice #hashtag and I #like it"; => result => #hashtag , #like
text2 = "#hopefully I will get #answer #here"; => result => #hopefully #answer #here
All these texts are in a SQL table and I forgot to make a column for hashtags which should store this data.
OR
The main Purpose is to extract these hashtags and show as user types relative words in search box
for e.g User types #h
he should see #hashtag (from text1 above example)
and #here (from text2 above example)
and #hopefully (from text2 above example)
You could get an array of hashtags like this:
const sentence = "This is a nice #hashtag and I #like it"
const hashtags = sentence.split(" ").filter(word=> word.startsWith("#"))
console.log(hashtags)