JSFiddle - React, Tailwind, and code Playground
by gkohen
JavaScript
var htmlRE = /^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/i;
console.log(htmlRE.test("first test"));
console.log(htmlRE.test("<first test>"));
console.log(htmlRE.test("<first test/>"));