D
DrewM
I'm attempting to clean up HTML in a database by quoting all unquoted
attributes.
So far, I have this:
oRegExp.Pattern = "<([^>]+)=([^>""]+)>"
sHtml = oRegExp.Replace(sHtml, "<$1=""$2"">")
which I can use to replace single attributes:
<p class=foo> becomes <p class="foo">
Now I'm trying to deal with multiple attributes and am getting myself
into a pickle converting:
<p class=foo name=bar> into <p class="foo" name="bar">
The best I've come up with so far is:
oRegExp.Pattern = "<(\w*\s)(([^=>]+=)([^>""\s]+))+>"
sHtml = oRegExp.Replace(sHtml, "<$1 $3""$4"">")
which obviously isn't going to work!
How can I match multiple unquoted attributes and replace them with quotes?
Thanks
Drew
attributes.
So far, I have this:
oRegExp.Pattern = "<([^>]+)=([^>""]+)>"
sHtml = oRegExp.Replace(sHtml, "<$1=""$2"">")
which I can use to replace single attributes:
<p class=foo> becomes <p class="foo">
Now I'm trying to deal with multiple attributes and am getting myself
into a pickle converting:
<p class=foo name=bar> into <p class="foo" name="bar">
The best I've come up with so far is:
oRegExp.Pattern = "<(\w*\s)(([^=>]+=)([^>""\s]+))+>"
sHtml = oRegExp.Replace(sHtml, "<$1 $3""$4"">")
which obviously isn't going to work!
How can I match multiple unquoted attributes and replace them with quotes?
Thanks
Drew