109,874
社区成员




string s = "20318";
bool result = Regex.IsMatch(s, @"^\d{5}$", RegexOptions.ECMAScript);
string s = "20318";
bool result = Regex.IsMatch(s, @"^[0-9]{5}$");
string str = "你要验证的字符串";
Regex re = new Regex(@"^\d{5}$", RegexOptions.None);
if (re.IsMatch(str))
{
//符合
}
else
{
//不符合
}
Regex re = new Regex(@"^\d{5}$", RegexOptions.None);