From 8d4a02816ca0155bc72108124846ea9f67c70680 Mon Sep 17 00:00:00 2001 From: Blake Embrey Date: Sun, 15 Sep 2024 13:36:48 -0700 Subject: [PATCH] Use \p{N} --- packages/title-case/src/index.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/title-case/src/index.ts b/packages/title-case/src/index.ts index d9dfdd09..4a5347c8 100644 --- a/packages/title-case/src/index.ts +++ b/packages/title-case/src/index.ts @@ -1,9 +1,8 @@ const TOKENS = /(\S+)|(.)/g; -const IS_SPECIAL_CASE = /[\.#]\p{Alphabetic}/u; // #tag, example.com, etc. +const IS_SPECIAL_CASE = /[\.#][\p{L}\p{N}]/u; // #tag, example.com, etc. const IS_MANUAL_CASE = /\p{Ll}(?=[\p{Lu}])/u; // iPhone, iOS, etc. -const ALPHANUMERIC_PATTERN = /[\p{Alphabetic}\p{Nd}]+/gu; -const IS_ACRONYM = - /^(\P{Alphabetic})*(?:\p{Alphabetic}\.){2,}(\P{Alphabetic})*$/u; +const ALPHANUMERIC_PATTERN = /[\p{L}\p{N}]+/gu; +const IS_ACRONYM = /^([^\p{L}])*(?:\p{L}\.){2,}([^\p{L}])*$/u; export const WORD_SEPARATORS = new Set(["—", "–", "-", "―", "/"]);