Skip to content

Commit

Permalink
Also consider Unicode zero-width spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaong committed Feb 29, 2024
1 parent 9cdb865 commit 529fb44
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/MiniSearch.ts
Expand Up @@ -2032,5 +2032,6 @@ const objectToNumericMap = <T>(object: { [key: string]: T }): Map<number, T> =>
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

0 comments on commit 529fb44

Please sign in to comment.