I want to be able to split strings while preserving HTML tags inside of them.
I am working on making a small typewriter effect for my website, but I want to be able to preserve HTML formatting while doing the effect.
e.g. Getting the first 10 characters of Hello, <strong>World</strong>!
would result in Hello, <strong>Wor</strong>
Is there an easy way to do this in JS? If not, what would be the best way that I do this (i.e. should I use regex or just vanilla JS)