C#如何用正则表达式从一段字符串中取出时间
<td><spanstyle="color:black"><spanclass="odisplayNone">6</span><spanclass="odisplayNo...
<td >
<span style="color:black"><span class="o displayNone">6</span><span class="o displayNone">6</span>11:05<span class="o displayNone">1</span><span class="o displayNone">1</span></span>
<span style="color:black"><span class="o displayNone">5</span><span class="o displayNone">4</span>15:10<span class="o displayNone">6</span><span class="o displayNone">3</span></span>
<a href="book_piao.php?id=49602920&data_source=1&film_index=28820110503151931" target="_blank"><span class="o displayNone">2</span><span class="o displayNone">3</span>17:35<span class="o displayNone">9</span><span class="o displayNone">:</span></a>
<a href="book_piao.php?id=49602921&data_source=1&film_index=28820110503151933" target="_blank"><span class="o displayNone">0</span>19:50<span class="o displayNone">1</span></a>
<a href="book_piao.php?id=49602922&data_source=1&film_index=28820110503151935" target="_blank"><span class="o displayNone">:</span><span class="o displayNone">1</span>22:05<span class="o displayNone">8</span><span class="o displayNone">3</span></a>
</td>
怎么能取出里边的所有时间 展开
<span style="color:black"><span class="o displayNone">6</span><span class="o displayNone">6</span>11:05<span class="o displayNone">1</span><span class="o displayNone">1</span></span>
<span style="color:black"><span class="o displayNone">5</span><span class="o displayNone">4</span>15:10<span class="o displayNone">6</span><span class="o displayNone">3</span></span>
<a href="book_piao.php?id=49602920&data_source=1&film_index=28820110503151931" target="_blank"><span class="o displayNone">2</span><span class="o displayNone">3</span>17:35<span class="o displayNone">9</span><span class="o displayNone">:</span></a>
<a href="book_piao.php?id=49602921&data_source=1&film_index=28820110503151933" target="_blank"><span class="o displayNone">0</span>19:50<span class="o displayNone">1</span></a>
<a href="book_piao.php?id=49602922&data_source=1&film_index=28820110503151935" target="_blank"><span class="o displayNone">:</span><span class="o displayNone">1</span>22:05<span class="o displayNone">8</span><span class="o displayNone">3</span></a>
</td>
怎么能取出里边的所有时间 展开
2个回答
展开全部
取出11:05这样的数据吗?正则:\d{1,2}:\d{1,2}
Regex reg = new Regex(@"\d{1,2}:\d{1,2}");
Match m = reg.Match(str);
while(m.Success){
Response.Write(m.Result("$0"));
m=m.NextMatch();
}
Regex reg = new Regex(@"\d{1,2}:\d{1,2}");
Match m = reg.Match(str);
while(m.Success){
Response.Write(m.Result("$0"));
m=m.NextMatch();
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询