[Solved] Detect Specific Words on string


Check this out, i add comment for easy understand this code

var str="@hello, world how are you. I @am good";
str = str.split(' '); // split text to word array
str = str.filter(function(word){
  return word.includes('@'); // check words that using @
}).map(function (word) {
  return word.replace(/[^a-zA-Z^@ ]/g, "") // remove special character except @
});
console.log(str) // show the data

solved Detect Specific Words on string