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
This commit is contained in:
JustArchi
2016-07-16 00:18:36 +02:00
parent 5a32e91e88
commit 1227709bc2

View File

@@ -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));