]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix nonsensical RegEx for name restriction (#34375)
authorHyper B <137433177+HyperB1@users.noreply.github.com>
Wed, 15 Jan 2025 15:59:04 +0000 (20:59 +0500)
committerGitHub <noreply@github.com>
Wed, 15 Jan 2025 15:59:04 +0000 (16:59 +0100)
* Fixed nonsense RegEx

"-" character is a range, caused an error.
No need for "," to repeat so much, it's not a separator.
"\\" - just why?

* Further optimized RegEx structure

Added:
"@" delimiter for consistency
"/" to escape "-" for good and to avoid further problems

Content.Shared/Preferences/HumanoidCharacterProfile.cs

index 54ae8c5788b456e9d649fb3a350537269ffa739f..35daa55bbc44c72fecea52a3b7094d7905856450 100644 (file)
@@ -25,7 +25,7 @@ namespace Content.Shared.Preferences
     [Serializable, NetSerializable]
     public sealed partial class HumanoidCharacterProfile : ICharacterProfile
     {
-        private static readonly Regex RestrictedNameRegex = new("[^A-Z,a-z,0-9, ,\\-,']");
+        private static readonly Regex RestrictedNameRegex = new(@"[^A-Za-z0-9 '\-]");
         private static readonly Regex ICNameCaseRegex = new(@"^(?<word>\w)|\b(?<word>\w)(?=\w*$)");
 
         public const int MaxNameLength = 32;