Test case details

Preparation Code

const testString = `<strong>title</strong> einen Farbabstand von Delta E<1 kalibriert und zeigt eine unglaublich realitätsgetreue Darstellung Ihrer Werke.`

Test cases

Test #1

const regex = /(<\/?[a-z0-3]+(?:\s[^">]*|"[^"]*")*>)/i testString.split(regex)

Test #2

const regex = /(<\/?[a-z0-3]+(?:|\s*|(?:\s[^"=>]+=\s*"[^"]*"|\s[^"=>]+){0,10})>)/i testString.split(regex)

Test #3

// the longest tag is 5 characters (tbody), so we can limit that // to avoid asterisk on whitespace, we can replace all concecutive whitespace with one single space, and then use ? instead. const regex = /(<\/?[a-z0-3]{2,5}(?:\s[^">]*|"[^"]*")*>)/i testString // replace all concecutive spaces with one .replace(/\ +/g, " ") .split(regex)