JSFiddle - React, Tailwind, and code Playground

JavaScript

var s = "the cow goes @moo";
var result = s.match(/@[\w]+/g);
alert(result);