【发布时间】:2014-03-14 08:33:58
【问题描述】:
我想用 Regex 检查一个字符串是否有 12 个字符,并且包含 a-f 和 0-9。
这是我的代码:
mac = "000475af588c"; //12 Characters
Match match = Regex.Match(mac, @"([A-Fa-f0-9]+)");
if (match.Success)
{
//todo
}
【问题讨论】:
-
你需要量词,
{12}。也可能是主播:^&$。
标签: c# asp.net regex string match