Matching two sections same number of times
- by Leszczu
Hello,
i need a HTML to parse:
<span>some text<span><span><span>text</span></span></span></span>
I need to remove unnecessary <span> occurrences, so that output is:
<span>some text<span>text</span></span>
I wrote a regex, which does this once:
/<SPAN>[^<]*<\/SPAN>/i
How to make this work same number of times on both <span> and </span>?