JSFiddle - React, Tailwind, and code Playground
HTML
<ul id='ul'></ul>
JavaScript
var regex = /\<([^\>]+)\>/;
test("Joao <[email protected]>");
test("Maria <[email protected]>");
function test(value) {
var li = document.createElement('li');
var text = value;
var match = regex.exec(value);
if (match)
text = text + " -- " + match[1];
else
text = text + " -- no match";
li.innerText = text;
document.getElementById('ul').appendChild(li);
}