I am looking for a regular expression which can erase all spans keeping inner text. I have this kind of spans in my inner HTML.
Input
Properly formatted HTML
<span style='font-size:10.0pt;font-family:"Arial","sans serif"'**>
First span
</span>
<span style="color:#221E1F;">
<span style='font-size:10.0pt;font-family:"Arial";color:windowtext'>
This is to test Regular expression
</span>
</span>
<span style="color:#221E1F;"><span style='font-size:10.0pt;font-family:
"Arial","sans-serif";color:#548DD4'>
last Span text
</span>
</span>
Not formatted properly:
<span style='font-size:10.0pt;font-family:"Arial","sans-serif";
mso-bidi-font-style:italic'><%T</span><span class="A1"><span style='font-size:
10.0pt;font-family:"Arial","sans-serif";mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;color:windowtext'>PA_Enrollment_Options%>
one of the convenient options below</span></span><span class="A1"><span style='font-size:10.0pt;font-family:"Arial","sans-serif";mso-fareast-font-family:
Calibri;mso-fareast-theme-font:minor-latin;color:#548DD4;mso-themecolor:text2;
mso-themetint:153'>: <o:p></o:p></span></span>
Expected Output : First Span This is to test Regular expression last span text
I have tried this regex - (<span.*([\r\n]).*>)|(<span.*>)|(</span>).
This is working when my HTML is properly formatted, but in my case indentation of HTML is not proper.
I am not using regex to parsing completely . I am doing this operation in inner html only