日期:2014-05-18  浏览次数:21229 次

跪求!正则表达式或其他方法解决问题!!
有一个获取的string,(内容如下:)现在要将其规范并分成行:

<td class="t_H2">综合损益表-全年业绩</td>
<td class="t_H2" id="H">2011/12</td>
<td class="t_H2" id="H">2011/06</td>
<td class="t_H2" id="H">2010/06</td>
<td class="t_H2" id="H">2009/06</td>
<td class="t_H2" id="H">2008/06</td>

<td class="t_T1">营业额</td>
<td class="t_C1_B" id="C">3,361</td>
<td class="t_C1" id="C">5,714</td>
<td class="t_C1" id="C">12,580</td>
<td class="t_C1" id="C">4,696</td>
<td class="t_C1" id="C">10,553</td>
<td class="t_LC" colspan="6"></td>

<td class="t_T1">经营溢利</td>
<td class="t_C1_B" id="C">3,525</td>
<td class="t_C1" id="C">7,842</td>
<td class="t_C1" id="C">30,495</td>
<td class="t_C1" id="C">7,003</td>
<td class="t_C1" id="C">17,468</td>
<td class="t_LC" colspan="6"></td>

<td class="t_T1">非经营/ 特殊项目</td>
<td class="t_C1_B" id="C"><span style="color:green;">-149</span></td>
<td class="t_C1" id="C"><span style="color:green;">-139</span></td>
<td class="t_C1" id="C"><span style="color:green;">-120</span></td>
<td class="t_C1" id="C">0</td>
<td class="t_C1" id="C">0</td>
<td class="t_LC" colspan="6"></td>


规范后要达到如下效果:


<tr>
<td class="t_H2">综合损益表-全年业绩</td>
<td class="t_H2" id="H">2011/12</td>
<td class="t_H2" id="H">2011/06</td>
<td class="t_H2" id="H">2010/06</td>
<td class="t_H2" id="H">2009/06</td>
<td class="t_H2" id="H">2008/06</td>
</tr>
<tr>
<td class="t_T1">营业额</td>
<td class="t_C1_B" id="C">3,361</td>
<td class="t_C1" id="C">5,714</td>
<td class="t_C1" id="C">12,580</td>
<td class="t_C1" id="C">4,696</td>
<td class="t_C1" id="C">10,553</td>
<td class="t_LC" colspan="6"></td>
</tr>
<tr>
<td class="t_T1">经营溢利</td>
<td class="t_C1_B" id="C">3,525</td>
<td class="t_C1" id="C">7,842</td>
<td class="t_C1" id="C">30,495</td>
<td class="t_C1" id="C">7,003</td>
<td class="t_C1" id="C">17,468</td>
<td class="t_LC" colspan="6"></td>
</tr>
<tr>
<td class="t_T1">非经营/ 特殊项目</td>
<td class="t_C1_B" id="C"><span style="color:green;">-149</span></td>
<td class="t_C1" id="C"><span style="col