Matching two sections same number of times
Posted
by
Leszczu
on Stack Overflow
See other posts from Stack Overflow
or by Leszczu
Published on 2010-12-30T12:29:54Z
Indexed on
2010/12/30
13:54 UTC
Read the original article
Hit count: 124
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>
?
© Stack Overflow or respective owner