From 1227709bc222463b27031d2a3d8ff3718ea01973 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Sat, 16 Jul 2016 00:18:36 +0200 Subject: [PATCH] Fix CD-key regex to be ignore-case Also modify regex a bit to not catch keys like AAAAA-AAAAA-AAAAA- and the ones that are too long --- ArchiSteamFarm/Bot.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index 86077d7f3..ca4e408c1 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -98,7 +98,7 @@ namespace ArchiSteamFarm { private static bool IsValidCdKey(string key) { if (!string.IsNullOrEmpty(key)) { - return Regex.IsMatch(key, @"[0-9A-Z]{4,5}-[0-9A-Z]{4,5}-[0-9A-Z]{4,5}-?(?:(?:[0-9A-Z]{4,5}-?)?(?:[0-9A-Z]{4,5}))?"); + return Regex.IsMatch(key, @"^[0-9A-Z]{4,5}-[0-9A-Z]{4,5}-[0-9A-Z]{4,5}(?:(?:-[0-9A-Z]{4,5})?(?:-[0-9A-Z]{4,5}))?$", RegexOptions.IgnoreCase); } Logging.LogNullError(nameof(key));