JSFiddle - React, Tailwind, and code Playground
HTML
Follow @amazon, @facebook & @anyoneelse
JavaScript
function replaceAtMentionsWithLinks ( text ) {
return text.replace(/@([a-z\d_]+)/ig, '<a href="http://twitter.com/$1">@$1</a>');
}
var replaced = replaceAtMentionsWithLinks(document.body.textContent);
document.body.innerHTML = replaced;