I got a string like this one:
var tweet ="@fadil good:))RT @finnyajja: what a nice day RT @fadielfirsta: how are you? @finnyajja yay";
what kind of code should work to extract any words with @ character and also removing any special char at the end of the words? so it would an array like this :
(@fadil, @finnyajja, @fadielfirsta, @finnyajja);
i have tried the following code :
var users = $.grep(tweet.split(" "), function(a){return /^@/.test(a)});
it returns this:
(@fadil, @finnyajja:, @fadielfirsta:, @finnyajja)
there’s still colon ‘:’ character at the end of some words. What should I do? any solution guys? Thanks
Here is code that is more straightforward than trying to use split: