正则表达式

网卡地址mac:
^([A-Fa-f0-9]{2}[-,:]){5}[A-Fa-f0-9]{2}$

// 首先要编译正则规则形式 Pattern p = Pattern.compile("abc"); // 将正则进行匹配 Matcher m = p.matcher(str); // 进行判断 boolean b = m.matches();

//匹配事件格式13:13

public static bool IsTime(string StrSource)
{
return Regex.IsMatch(StrSource, @"^(([0-5]?\d):[0-5]?\d)$");
}

posted @ 2019-08-21 17:49  程旭清  阅读(155)  评论(0编辑  收藏  举报