I want to extract out hashtags from a sentence. For eg- if the sentence is
#test1.#test2 #test3 www.google.com/#test4 www.google.com/hello#test5
the hashtags would be
#test1
#test2
#test3
but not #test4 or #test5 as they are part of URLs
I was trying to make the regex for this. till now i have
/(^|\s)#(\w+)\b/g
https://regex101.com/r/WPeSdE/1
this takes care of #test1 and #test3 but fails to get #test2.
Please help.
Needed a very complex regex to support what i needed. In the end, for now i ended up using hashtag function of twitter.txt library. handles all the cases i was stuck with.