Last updated 3 years ago
<script> var div = document.querySelector("p.match"); div.innerHTML = div.innerHTML.replace(/\@[A-Za-z0-9]+|\#[A-Za-z0-9]+/g, function(match) { return "<i style=color:#fff;font-weight:bold>" + match + "</i>" }); console.log(div) </script>