From 529fb44e76bc890e4b4e4e9d0ed67a727835a5b1 Mon Sep 17 00:00:00 2001 From: Luca Ongaro Date: Thu, 29 Feb 2024 12:32:50 +0100 Subject: [PATCH] Also consider Unicode zero-width spaces --- src/MiniSearch.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/MiniSearch.ts b/src/MiniSearch.ts index ed6717bf..eeff71ec 100644 --- a/src/MiniSearch.ts +++ b/src/MiniSearch.ts @@ -2032,5 +2032,6 @@ const objectToNumericMap = (object: { [key: string]: T }): Map => return map } -// This regular expression matches any Unicode space, newline, or punctuation character -const SPACE_OR_PUNCTUATION = /[\n\r\p{Z}\p{P}]/u +// This regular expression matches any Unicode space (including zero-width +// spaces \u200B-\u200D and \uFEFF), newline, or punctuation character +const SPACE_OR_PUNCTUATION = /[\n\r\p{Z}\p{P}\u200B-\u200D\uFEFF]/u