I want to get the characters after the @ character before the space character.
eg. if my line is like hello @world. some gibberish.@stackoverflow hello @world. some gibberish.@stackoverflow . Then I want to get the symbols "world" and "stackoverflow".
Here is what I tried.
var comment = 'hello @world. some gibberish.@stackoverflow '; var indices = []; for (var i = 0; i < comment.length; i++) { if (comment[i] === "@") { indices.push(i); for (var j = 0; j <= i; j++){ startIndex.push(comment[j]); } } }
I can get @ occurrences and spaces, and then trim this part to get my content, but I would like to get a better solution / suggestion for this without REGEX. Thanks in advance.
source share