Hi,
I'm writing a HTML parser in Flex (AS3) and I need to remove some HTML tags that are not needed.
For example, I want to remove the divs from this code:
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p style="padding-left: 18px; padding-right: 20px; text-align: center;">
<span></span>
<span style=" font-size: 48px; color: #666666; font-style: normal; font-weight: bold; text-decoration: none; font-family: Arial;">20% OFF.</span>
<span> </span>
<span style=" font-size: 48px; color: #666666; font-style: normal; font-weight: normal; text-decoration: none; font-family: Arial;">Do it NOW!</span>
<span> </span>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
and end with something like this:
<div>
<p style="padding-left: 18px; padding-right: 20px; text-align: center;">
<span></span>
<span style=" font-size: 48px; color: #666666; font-style: normal; font-weight: bold; text-decoration: none; font-family: Arial;">20% OFF.</span>
<span> </span>
<span style=" font-size: 48px; color: #666666; font-style: normal; font-weight: normal; text-decoration: none; font-family: Arial;">Do it NOW!</span>
<span> </span>
</p>
</div>
My question is, how can I write a regular expression to remove these unwanted DIVs? Is there a better way to do it?
Thanks in advance.