diff --git a/src/HotChocolate/Core/src/Types.Analyzers/Helpers/GeneratorUtils.cs b/src/HotChocolate/Core/src/Types.Analyzers/Helpers/GeneratorUtils.cs index 25638e28c71..5aac09ff94c 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/Helpers/GeneratorUtils.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/Helpers/GeneratorUtils.cs @@ -8,7 +8,7 @@ namespace HotChocolate.Types.Analyzers.Helpers; internal static class GeneratorUtils { private static readonly Regex s_invalidCharsRegex = new("[^a-zA-Z0-9]", RegexOptions.Compiled); - private static readonly Regex s_xmlWhitespaceRegex = new(@"(\n[ \t]*)", RegexOptions.Compiled); + private static readonly Regex s_xmlWhitespaceRegex = new(@"\n[ \t]*", RegexOptions.Compiled); public static ModuleInfo GetModuleInfo( this ImmutableArray syntaxInfos, diff --git a/src/HotChocolate/Core/src/Types.Scalars/IPv4Type.cs b/src/HotChocolate/Core/src/Types.Scalars/IPv4Type.cs index 4550cb7f445..17b0b7bff6a 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/IPv4Type.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/IPv4Type.cs @@ -10,9 +10,9 @@ namespace HotChocolate.Types; public partial class IPv4Type : RegexType { private const string ValidationPattern = - @"(^(?:(?:(?:0?0?[0-9]|0?[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}(?:0?0?" + @"^(?:(?:(?:0?0?[0-9]|0?[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}(?:0?0?" + @"[0-9]|0?[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\/(?:[0-9]|[1-2][0-9]|3[0" - + @"-2]))?)\z)"; + + @"-2]))?)\z"; [GeneratedRegex(ValidationPattern, RegexOptions.None, DefaultRegexTimeoutInMs)] private static partial Regex CreateRegex(); diff --git a/src/HotChocolate/Core/src/Types.Scalars/IPv6Type.cs b/src/HotChocolate/Core/src/Types.Scalars/IPv6Type.cs index 9db05f0bbb1..de9e3e6b225 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/IPv6Type.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/IPv6Type.cs @@ -10,7 +10,7 @@ namespace HotChocolate.Types; public partial class IPv6Type : RegexType { private const string ValidationPattern = - "(^(?:(?:(?:[0-9A-Fa-f]{1,4}:){6}(?:[0-9A-Fa-f]{1,4}:[0-9A-Fa-f]{1,4}|(?:(?:0?0?" + "^(?:(?:(?:[0-9A-Fa-f]{1,4}:){6}(?:[0-9A-Fa-f]{1,4}:[0-9A-Fa-f]{1,4}|(?:(?:0?0?" + "[0-9]|0?[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}(?:0?0?[0-9]|0?[1-9][" + "0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]))|::(?:[0-9A-Fa-f]{1,4}:){5}(?:[0-9A-Fa-f]" + "{1,4}:[0-9A-Fa-f]{1,4}|(?:(?:0?0?[0-9]|0?[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[" @@ -31,7 +31,7 @@ public partial class IPv6Type : RegexType + "1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}(?:0?0?[0-9]|0?[1-9][0-9]|1[0-9][0-9]|2[" + "0-4][0-9]|25[0-5]))|(?:(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f" + "]{1,4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})?::)(?:\\/(?:0?0?[0-9]|0?[" - + "1-9][0-9]|1[01][0-9]|12[0-8]))?)\\z)"; + + "1-9][0-9]|1[01][0-9]|12[0-8]))?)\\z"; [GeneratedRegex(ValidationPattern, RegexOptions.None, DefaultRegexTimeoutInMs)] private static partial Regex CreateRegex(); diff --git a/src/HotChocolate/Core/src/Types.Scalars/RgbType.cs b/src/HotChocolate/Core/src/Types.Scalars/RgbType.cs index c1df491ef5b..36dc3e8e9a3 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/RgbType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/RgbType.cs @@ -12,7 +12,7 @@ namespace HotChocolate.Types; public partial class RgbType : RegexType { private const string ValidationPattern = - "(rgb\\((?:[0-9]+%?(?:,|\\s)+){2}[0-9]+%?\\))"; + "rgb\\((?:[0-9]+%?(?:,|\\s)+){2}[0-9]+%?\\)"; [GeneratedRegex(ValidationPattern, RegexOptions.IgnoreCase, DefaultRegexTimeoutInMs)] private static partial Regex CreateRegex(); diff --git a/src/HotChocolate/Core/src/Types.Scalars/RgbaType.cs b/src/HotChocolate/Core/src/Types.Scalars/RgbaType.cs index cfe0d9adfa6..554539ecfa2 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/RgbaType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/RgbaType.cs @@ -10,7 +10,7 @@ namespace HotChocolate.Types; public partial class RgbaType : RegexType { private const string ValidationPattern = - "(rgba?\\((?:[0-9]+%?(?:,|\\s)+){2}[0-9]+%?\\s*[,\\/]\\s*[0-9\\.]+%?\\))"; + "rgba?\\((?:[0-9]+%?(?:,|\\s)+){2}[0-9]+%?\\s*[,\\/]\\s*[0-9\\.]+%?\\)"; [GeneratedRegex(ValidationPattern, RegexOptions.IgnoreCase, DefaultRegexTimeoutInMs)] private static partial Regex CreateRegex(); diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/XmlDocumentationProvider.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/XmlDocumentationProvider.cs index b4f1df150cf..06c23cb94ef 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/XmlDocumentationProvider.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/XmlDocumentationProvider.cs @@ -369,7 +369,7 @@ private void ProcessInheritdocInterfaceElements( "\n" + documentation.Replace("\r", string.Empty).Trim('\n'); var whitespace = - Regex.Match(documentation, "(\\n[ \\t]*)").Value; + Regex.Match(documentation, "\\n[ \\t]*").Value; documentation = documentation.Replace(whitespace, "\n");