public static string Input(string standard)
{
Regex regex = new Regex(standard);
string input = Console.ReadLine();
while(regex.IsMatch(input)==false)
{
Console.Write("输入无效,请重新输入:");
input = Console.ReadLine();
}
return input;
}
转载于:https://www.cnblogs.com/forekoy/p/6374807.html