public static string ValidateShot(PlayerInfoModel player, string shotElection) { // Validate string string pattern = @"(^[A-Ea-e][1-5]$)"; Regex reg = new Regex(pattern); // Validate shot position bool isFreeSpot = false; bool checkSpot = false; do { if (reg.IsMatch(shotElection) == false) { Console.Write(" Invalid shot. Please try again: "); shotElection = Console.ReadLine(); } else if (reg.IsMatch(shotElection) == true && checkSpot == false) { isFreeSpot = GameLogic.ValidateShotSpot(player, shotElection); checkSpot = true; } else if (isFreeSpot == false) { Console.Write(" You had already shot there. Please try again: "); shotElection = Console.ReadLine(); checkSpot = false; } else if (reg.IsMatch(shotElection) == true && checkSpot == true) { isFreeSpot = true; } } while (reg.IsMatch(shotElection) == false || isFreeSpot == false); return(shotElection); }