求个正则表达式

ttlrwdl 2006-04-28 05:29:25
字符串如下
<th width="16%" class="tdc1">2006-4-26</td> <th width="16%" class="tdc1">2006-4-27</td> <th width="16%" class="tdc1">2006-4-28</td> <th width="16%" class="tdc1">2006-4-29</td> <th width="16%" class="tdc1">2006-4-30</td> </tr> <tr>
想要5个日期的正则如何写 读出
谢谢
...全文
119 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
linuxyf 2006-04-30
  • 打赏
  • 举报
回复
try {
Regex RegexObj = new Regex("(19|20)\\d\\d[-/](0?[1-9]|1[012])[-/]([12][0-9]|3[01]|0?[1-9])");
Match MatchResults = RegexObj.Match(SubjectString);
while (MatchResults.Success) {

MatchResults = MatchResults.NextMatch();
}
} catch (ArgumentException ex) {
// Syntax error in the regular expression
}
ttlrwdl 2006-04-28
  • 打赏
  • 举报
回复
求帮助
ttlrwdl 2006-04-28
  • 打赏
  • 举报
回复
能详细点不?
Matthewzhong 2006-04-28
  • 打赏
  • 举报
回复
\d{4}[-]\d{1,2}[-]\d{1,2}

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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