I'm trying to highlight vowels for a simple reading aid website.
I have some HTML and want to highlight vowels, but there's also some HTML that I don't want to mess with. Basically only just <mark data-trigger="">other word</mark>
To clarify.
I have this:
Hello, this is a <mark data-trigger="">word</mark> that is in the text. I
want to get all vowels and wrap it in spans, but avoid messing with the other
html.
I want this:
H<span>e</span>ll<span>o</span>, th<span>i</span>s <span>i</span>s a <mark data-trigger="">word</mark> th<span>a</span>t...
I know this replaces all vowels > replace(/(a|e|i|o|u)/ig, "<span class='vowel'>$1</span>")
It would be enough to add "don't mess with anything inside MARK tags"
Can I achieve this using RegExp?
I can use external libraries, jQuery or whatever.