正则表达式的匹配td内的数据 财富值82

2016-10-23 17:03发布

<tr>         <td scope="col" align="center" valign="middle" nowrap>&nbsp;1</td>         <td scope="col" align="left" valign="middle" nowrap>&nbsp;13110581130</td>         <td scope="col" align="left" valign="middle" nowrap>&nbsp;徐小胖</td>         <td scope="col" align="center" valign="middle" nowrap>&nbsp;男</td>         <td scope="col" align="center" valign="middle" nowrap>&nbsp;2013</td>         <td scope="col" align="left" valign="middle" nowrap>&nbsp;</td>         <td scope="col" align="left" valign="middle" nowrap>&nbsp;计算机科学与技术</td>         <td scope="col" align="center" valign="middle" nowrap>&nbsp;</td>         <td scope="col" align="center" valign="middle" nowrap>&nbsp;</td>         <td scope="col" align="left" valign="middle" nowrap>&nbsp;</td>       </tr>        <tr>         <td scope="col" align="center" valign="middle" nowrap>&nbsp;2</td>         <td scope="col" align="left" valign="middle" nowrap>&nbsp;13110581131</td>         <td scope="col" align="left" valign="middle" nowrap>&nbsp;兴小胖</td>         <td scope="col" align="center" valign="middle" nowrap>&nbsp;男</td>         <td scope="col" align="center" valign="middle" nowrap>&nbsp;2013</td>         <td scope="col" align="left" valign="middle" nowrap>&nbsp;</td>         <td scope="col" align="left" valign="middle" nowrap>&nbsp;计算机科学与技术</td>         <td scope="col" align="center" valign="middle" nowrap>&nbsp;</td>         <td scope="col" align="center" valign="middle" nowrap>&nbsp;</td>         <td scope="col" align="left" valign="middle" nowrap>&nbsp;</td>       </tr>

我想匹配td内的数据,比如 徐小胖,

/<td scope="col" align=.*</td>/g

上面的正则还可以再优化吗?能更精确的抓取数据吗?谢谢指点

友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
5条回答

为什么不用xpath呢?
如果是我,我会这样写

一周热门 更多>