JSFiddle - React, Tailwind, and code Playground

by Thornton_Fernbacher

HTML

<div class="comment-details">Hello @samplename This is my comment</div>

JavaScript

$(function() {
	$('.comment-details').each(function() {
  	var text = $(this).innerHTML,
    names = text.match(/@\w+/g);
    for(var i in names) {
    	var name = names[i];
      
    }
    
  });
});