I'm working on a script and need to split strings which contain both html tags and text. I'm trying to isolate the tags and eliminate the text.
For example, I want this:
string = "<b>Text <span>Some more text</span> more text</b>";
to be split like this:
separation = string.split(/some RegExp/);
and become:
separation[0] = "<b>";
separation[1] = "<span>";
separation[2] = "</span>";
separation[3] = "</b>";
I would really appreciate any help or advice.
<b attribute="...">. Do you want everything up to the>? If so, you'll need a more advanced parser to cover all bases... Or consider using the one build into your browser (HTML -> DOM).