求正则表达式把一段字符串形式的静态html的table表里的每个td或者th里的文字值取出来

w091b 2013-11-25 04:47:58
要求如题目所言

<thead>
<tr>
<td class="emptyRow" colspan="5"></td>
</tr>
<tr>
<th style="width: 40% ;text-align:left" axis="length" colspan="2" scope="col">星期一, 十月 28, 2013 </th>
<th style="width: 30% ;text-align:left " axis="length" scope="col">位置</th>
<th style="width: 9%;text-align:left" axis="length" scope="col">时间</th>
<th style="width: 25% ;text-align:left" class="lastChild" axis="length" scope="col">件</th>

</tr>
</thead>
<tbody>
<tr>
<td style="width: 5% ;text-align:left" class="">16</td>
<td style="text-align:left" class="">已派送并签收: PUSHPA</td>
<td style="text-align:left" class=""> PORT OUIS </td>
<td class="">09:08</td>
<td class="lastChild "><!--start contentteaser -->
<div class="dhl">
<div>
<!--optional: start Expandable links -->
<div class="article_list">
<div class="dijitArticleTitlePane dijitContentPane" id="dijit_ArticleTitlePane_1" title="" widgetid="dijit_ArticleTitlePane_1">
<div dojoattachpoint="focusNode" class="dijitArticleTitlePaneTitle dijitOpen" wairole="button" tabindex="0" dojoattachevent="onclick:toggle,onkeypress: _onTitleKey,onfocus:_handleFocus,onblur:_handleFocus" role="button" aria-haspopup="true">
<div class="dijitInline dijitArrowNode" dojoattachpoint="arrowNode"><span class="dijitArrowNodeInner" dojoattachpoint="arrowNodeInner">-</span></div>
<div class="dijitArticleTitlePaneTextNode" dojoattachpoint="titleNode" style="-moz-user-select: none;">1 件</div>
</div>
<div dojoattachpoint="hideNode" class="dijitArticleTitlePaneContentOuter" style="">
<div dojoattachpoint="wipeNode" class="dijitReset" style="overflow: hidden; height: auto;">
<div tabindex="-1" wairole="region" dojoattachpoint="containerNode" class="dijitArticleTitlePaneContentInner" role="region" aria-labelledby="">
<!-- nested divs because wipeIn()/wipeOut() doesn't work right on node w/padding etc. Put padding on inner div. -->

<div class="ArticleTitleContent">
<div>JD014557964330001499</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--optional: end Expandable links -->
<div class="clearAll"> </div>
</div>
</div>
<!--end contentteaser --></td>
</tr>
</tbody>
...全文
158 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Mic_Gary 2013-11-25
  • 打赏
  • 举报
回复
http://bbs.csdn.net/topics/320056434 干脆不要用正则,看看这个贴,不知道能不能有启发
Mic_Gary 2013-11-25
  • 打赏
  • 举报
回复
感觉这样的需求用正则有点不科学啊,loading……
Mic_Gary 2013-11-25
  • 打赏
  • 举报
回复
标记一下,下班后再来看看

61,115

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧