I'm trying to change some HTML text using regex, I have this:
<font class="Apple-style-span" color="#0036ff">This is a text</font>
Using this regex: .replaceAll("(<font.+)\\S*color+.*?(>)","<span class=\"c2f\">");
It became: <span class="c2f">This is a text</span>
(i use another regex to change )
But the problem happens when I have nested font like this:
<font class="Apple-style-span" color="#0036ff">This is a text AND <font class="Apple-style-span" color="#0036ff">This is Edited TOOO</font></font>
It became: <span class="c2f">This is Edited TOOO</span></span>
(changed /font using replace too)
I can understand why it happens, but I don't know how to make it match each tag.
What I want:
<span class="c2f">This is a text AND <span class="c2f">This is Edited TOOO</span></span>
Is this possible or I need another "approach"?