使用Regex进行正则表达
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;
}