JSFiddle - React, Tailwind, and code Playground
JavaScript
const regex = />([^(>|<|)]+)(<|>)/gm
const [match, text] = regex.exec('<a>te\nst</a>')
console.log(match, text)
const regex = />([^(>|<|)]+)(<|>)/gm
const [match, text] = regex.exec('<a>te\nst</a>')
console.log(match, text)