JSFiddle - React, Tailwind, and code Playground

JavaScript

alert("text <! inside > text <! another inside > text".replace(/<!([^>]*)>/g, "<span>$1</span>"));