9
I have a content posting system on a particular social network of our company.
When the user type the text with hashtags
, I need to detect all of them and store them in an array.
Example:
Hi, I’m posting this #question on #stackoverlow. I hope you find good #answers.
I want you to call me back:
array('pergunta', 'stackoverlow', 'respostas');
Remembering that if the hashtag contains accentuated characters, they should also be processed.
Example:
#notícias
#sãoPaulo
http://stackoverflow.com/a/3060756/4056678
– Renan Gomes
If there is a possibility of hashtag starting or having accented characters the solution will fail. To avoid this you can use REGEX `#([ s]*)
– Marcos Regis
Using the u modifier as @rray showed, no problem
– Wallace Maxters