I want to extract #hashtags from a string, also those that have special characters such as #1+1
.
Currently I'm using:
@hashtags ||= string.scan(/#\w+/)
But it doesn't work with those special characters. Also, I want it to be UTF-8 compatible.
How do I do this?
EDIT:
If the last character is a special character it should be removed, such as #hashtag,
#hashtag.
#hashtag!
#hashtag?
etc...
Also, the hash sign at the beginning should be removed.