求一个正则表达式

影子tec 网络工程师  2009-07-29 11:24:31
<tr>
<td height="23" align="center" class="bj-

F0F0F0"><span class="flow_font">324073</span></td>
<td align="center" class="bj-F0F0F0" > <img

width="23" height="23" src="/happy8/v1/Images/FeiPan/c4.gif" alt=""/></td>
<td align="center" class="bj-不定">02</td>
<td align="center" class="bj-不定">06</td>
<td align="center" class="bj-不定">08</td>
<td align="center" class="bj-不定">15</td>
<td align="center" class="bj-不定">17</td>
<td align="center" class="bj-不定">23</td>
<td align="center" class="bj-不定">28</td>
<td align="center" class="bj-不定">29</td>
<td align="center" class="bj-不定">30</td>
<td align="center" class="bj-不定">38</td>
<td align="center" class="bj-

F0F0F0"><a href="javascript:gotoImageWindowBysize('324073')"></a></td>
</tr>

这样一段代码
要求结果是

324073,4,02,06,08,15,17,23,28,29,30,38
...全文
43 点赞 收藏 3
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
影子tec 2009-07-30
谢谢,这个是只取数字吗?如果不是数据怎么办?
回复
zpzk123 2009-07-30
就是提取<span class="flow_font">和
<td align="center" class="bj-不定">的内容,没有任何变化,所以直接引用就行。

正则:"/<span class=\"flow_font\">(.*)</span>|<td align=\"center\" class=\"bj-不定\">(.*)<\/td>/U"
回复
cpp2017 2009-07-29
<%
Dim str
Dim Reg
Dim mc
Dim i
Set Reg = new RegExp
Reg.Global = true
Reg.Pattern = ">\s*(\d+)\s*<"
Reg.Multiline = true
str ="<tr> <td height=""23"" align=""center"" class=""bj-F0F0F0""> <span class=""flow_font"">324073 </span> </td> <td align=""center"" class=""bj-F0F0F0"" > <imgwidth=""23"" height=""23"" src=""/happy8/v1/Images/FeiPan/c4.gif"" alt=""""/> </td> <td align=""center"" class=""bj-不定"">02 </td> <td align=""center"" class=""bj-不定"">06 </td> <td align=""center"" class=""bj-不定"">08 </td> <td align=""center"" class=""bj-不定"">15 </td> <td align=""center"" class=""bj-不定"">17 </td> <td align=""center"" class=""bj-不定"">23 </td> <td align=""center"" class=""bj-不定"">28 </td> <td align=""center"" class=""bj-不定"">29 </td> <td align=""center"" class=""bj-不定"">30 </td> <td align=""center"" class=""bj-不定"">38 </td> <td align=""center"" class=""bj-F0F0F0""> <a href=""javascript:gotoImageWindowBysize('324073')""> </a> </td> </tr>"
set mc = Reg.Execute(str)

for each m in mc
' Response.Write(mc(i).submatch("$1"))

Response.Write(m.SubMatches(0)&",")
next
%>
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告