From f823aebdf142e590f819155480f48571dd1400ca Mon Sep 17 00:00:00 2001 From: Maha Date: Sun, 15 Sep 2024 15:32:55 -0400 Subject: [PATCH] reverse refactor of normalizedInputName to allow digit --- src/utils/validateTrimmedString.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/validateTrimmedString.ts b/src/utils/validateTrimmedString.ts index 43d4c28..6867f17 100644 --- a/src/utils/validateTrimmedString.ts +++ b/src/utils/validateTrimmedString.ts @@ -13,9 +13,11 @@ export function validateItemName( } //Remove punctuation marks and normalize input - const punctuationRegex = /[^a-z0-9]/g; + const punctuationRegex = /[^\p{L}]/gu; - const normalizedInputName = input.toLowerCase().replace(/[^a-z0-9]/g, ""); + const normalizedInputName = trimmedInput + .replace(punctuationRegex, "") + .toLowerCase(); //Create a list of normalized existing item names const normalizedExistingItemNames = existingItems.map((existingItem) => {