From e752561d20887062e91b3797cf4ff4fade12f555 Mon Sep 17 00:00:00 2001 From: Hyper B <137433177+HyperB1@users.noreply.github.com> Date: Wed, 15 Jan 2025 20:59:04 +0500 Subject: [PATCH] Fix nonsensical RegEx for name restriction (#34375) * 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Shared/Preferences/HumanoidCharacterProfile.cs b/Content.Shared/Preferences/HumanoidCharacterProfile.cs index 54ae8c5788..35daa55bbc 100644 --- a/Content.Shared/Preferences/HumanoidCharacterProfile.cs +++ b/Content.Shared/Preferences/HumanoidCharacterProfile.cs @@ -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(@"^(?\w)|\b(?\w)(?=\w*$)"); public const int MaxNameLength = 32;