JSFiddle - React, Tailwind, and code Playground
by elclanrs
JavaScript
var str = 'Hey there @userone, my email address is [email protected], lorem ipsum @usertwo.'
var getTwitter = function (str) {
var re = /[^\w](@\w+)/g,
matches = [],
tweets = []
while (matches = re.exec(str))
tweets.push(matches[1])
return tweets
}
console.log(getTwitter(str))