From 2e7b3d520ad042e5c191ddfccfae3f4832d86cdf Mon Sep 17 00:00:00 2001
From: AdmiringWorm <kim.nordmo@gmail.com>
Date: Fri, 7 Aug 2020 04:00:02 +0200
Subject: [PATCH] Update regex to correctly identify Windows 10

When running .NET Core 2.1 or .NET Framework 4.6.1, the used regex for
detecting Windows 10 TrueColor support does not match the OSDescription.
The reason for this is because on those frameworks the description has
trailing whitespaces, but they do not on .NET Core 3.1.
This commit updates the regex to ignore any trailing whitespaces.
---
 src/Spectre.Console/Internal/Colors/ColorSystemDetector.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Spectre.Console/Internal/Colors/ColorSystemDetector.cs b/src/Spectre.Console/Internal/Colors/ColorSystemDetector.cs
index e6ca217..6f6626f 100644
--- a/src/Spectre.Console/Internal/Colors/ColorSystemDetector.cs
+++ b/src/Spectre.Console/Internal/Colors/ColorSystemDetector.cs
@@ -19,7 +19,7 @@ namespace Spectre.Console.Internal
             {
                 if (supportsAnsi)
                 {
-                    var regex = new Regex("^Microsoft Windows (?'major'[0-9]*).(?'minor'[0-9]*).(?'build'[0-9]*)$");
+                    var regex = new Regex("^Microsoft Windows (?'major'[0-9]*).(?'minor'[0-9]*).(?'build'[0-9]*)\\s*$");
                     var match = regex.Match(RuntimeInformation.OSDescription);
                     if (match.Success && int.TryParse(match.Groups["major"].Value, out var major))
                     {