找到答案:
public static bool IsRegexCtnNo(string strCtnNo)
{
Regex rg = new Regex(@"[A-Z]{4}[0-9]{6,8}");
if(strCtnNo.Length > 12)
return false;
Match mh = rg.Match(strCtnNo,0,strCtnNo.Length);
if(mh.Success)
{
if(mh.Index == 0)
return true;
}
return false;
}
public static bool IsRegexCtnNo(string strCtnNo)
{
Regex rg = new Regex(@"[A-Z]{4}[0-9]{6,8}");
if(strCtnNo.Length > 12)
return false;
Match mh = rg.Match(strCtnNo,0,strCtnNo.Length);
if(mh.Success)
{
if(mh.Index == 0)
return true;
}
return false;
}
@"^[a-zA-Z]{4}[0-9]{6,8}$"