【发布时间】:2020-08-28 14:20:35
【问题描述】:
我有一个像这样的长字符串。
<p>Some Text above the tabular data. I hope this text will be seen.</p>
<table border="1" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width:150px">
<p>S.No.</p>
</td>
</td>
</tr>
<tr>
<td style="width:150px">
<p>2</p>
</td>
</tbody>
</table>
<p> </p>
<p>Please go through this tabular data.</p>
<table border="1" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width:150px">
<p>S.No.</p>
</td>
</tr>
<tr>
<td style="width:150px">
<p>1</p>
</td>
<tr>
<td style="width:150px">
>
</td>
</td>
</tr>
</tbody>
</table>
<p>End Of String</p>
现在我想像这样在 html 表之前和之后提取整个字符串。并添加“HTML Table...”代替 HTML Table。我尝试了几件事,但无法实现。尝试拆分成数组,但没有成功
样本输出
<p>Some Text above the tabular data. I hope this text will be seen.</p>
<p> </p>
HTML Table....
<p>Please go through this tabular data.</p>
<p>End Of String</p>
【问题讨论】:
-
由于堆栈溢出限制,我已经从 HTML 表的字符串中删除了相当多的内容。
标签: java string string-matching