110,535
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
namespace sxLdfang
{
class Program
{
static void Main(string[] args)
{
string html = @"0:00;5:00;8:07;08:59;10:20;;;";
string pattern = @"^(\s*((\d|[01]\d|2[0-4]):[0-5]\d)?\s*[;;]){7}\s*((\d|[01]\d|2[0-4]):[0-5]\d)?\s*$";
if(Regex.IsMatch(html,pattern))
{
Console.WriteLine("匹配成功!");
}
else
{
Console.WriteLine("输入存在错误!");
}
Console.ReadKey();
}
}
}