From 95979738c2eee40da33969298d3b3aa32917f75a Mon Sep 17 00:00:00 2001 From: Dimsday Date: Wed, 27 Sep 2023 17:32:11 +0500 Subject: [PATCH] Allow letters from any language in names --- XmlSchemaClassGenerator/CodeUtilities.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/XmlSchemaClassGenerator/CodeUtilities.cs b/XmlSchemaClassGenerator/CodeUtilities.cs index 336cc8b9..1557cee2 100644 --- a/XmlSchemaClassGenerator/CodeUtilities.cs +++ b/XmlSchemaClassGenerator/CodeUtilities.cs @@ -14,12 +14,12 @@ namespace XmlSchemaClassGenerator { public static class CodeUtilities { - private static readonly Regex invalidCharsRgx = new("[^_a-zA-Z0-9]"); + private static readonly Regex invalidCharsRgx = new(@"[^_\p{L}\p{N}]"); private static readonly Regex whiteSpace = new(@"(?<=\s)"); - private static readonly Regex startsWithLowerCaseChar = new("^[a-z]"); - private static readonly Regex firstCharFollowedByUpperCasesOnly = new("(?<=[A-Z])[A-Z0-9]+$", RegexOptions.None, TimeSpan.FromSeconds(1)); - private static readonly Regex lowerCaseNextToNumber = new("(?<=[0-9])[a-z]"); - private static readonly Regex upperCaseInside = new("(?<=[A-Z])[A-Z]+?((?=[A-Z][a-z])|(?=[0-9]))", RegexOptions.None, TimeSpan.FromSeconds(1)); + private static readonly Regex startsWithLowerCaseChar = new(@"^\p{Ll}"); + private static readonly Regex firstCharFollowedByUpperCasesOnly = new(@"(?<=\p{Lu})[\p{Lu}\p{N}]+$", RegexOptions.None, TimeSpan.FromSeconds(1)); + private static readonly Regex lowerCaseNextToNumber = new(@"(?<=\p{N})\p{Ll}"); + private static readonly Regex upperCaseInside = new(@"(?<=\p{Lu})\p{Lu}+?((?=\p{Lu}\p{Ll})|(?=\p{N}))", RegexOptions.None, TimeSpan.FromSeconds(1)); // Credits: chviLadislav // https://stackoverflow.com/questions/18627112/how-can-i-convert-text-to-pascal-case @@ -485,4 +485,4 @@ private static TypeInfo Make(string @namespace, [CallerMemberName] string name = } //Fixes a bug with VS2019 (https://developercommunity.visualstudio.com/content/problem/1244809/error-cs0518-predefined-type-systemruntimecompiler.html) -namespace System.Runtime.CompilerServices { internal static class IsExternalInit { } } \ No newline at end of file +namespace System.Runtime.CompilerServices { internal static class IsExternalInit { } }