Hello everyone,
I ran into an issue that I could use a little help with. I need to search a large string, match certain parts of it, and replace a certain part of the certain part. The entire string is made up of spans, tables, and images, to build a tree. The string is what's returned from the xmlParser. What I need to do is like this:
<span id="node1" style="blah:10px" />
There are a few of these buried within the rest of the structure. I need to search the structure, and change the above line to this:
<span id="node1" style="blah:10px"[B]></span>[/B]
The reason for this, is when i do treePanel.innerHTML = myBigString;
in Firefox, these spans become nested because the '/' is stripped out. (I verified this by passing in a modified version where I manually changed the /> to ></span> and it worked). So what I need, is to come up with the regex to find this. I think I can get what I need to match, but I'm unsure how to go about replacing. Here's what I have to match:
myRegexp = /<span.*(\/>)/gi;
I believe that will start matching when it finds <span
and then stop when it encounters />
. The parens will save the ordered variable as $1. How do I replace that with ></span>?
Thank you,
jmasta