Skip to content

Commit 800c1ff

Browse files
committed
Update regex in semantic.ts to include number matching
1 parent 7b96129 commit 800c1ff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/semantic.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export function semanticWords(text: string, concatCjk = false): string[] {
185185
// Construct the regular expression dynamically based on the concatCjk flag.
186186
// This regex pattern aims to match Latin vocabulary words or CJK characters (grouped or not based on concatCjk).
187187
// The use of non-capturing groups (?:) and 'ug' flags ensures global matching of all occurrences in Unicode mode.
188-
const regex = new RegExp(`${regexMap.latinVocab}|${regexMap.cjk}${concatCjk ? '+' : ''}`, 'ug');
188+
const regex = new RegExp(`${regexMap.latinVocab}|${regexMap.number}+|${regexMap.cjk}${concatCjk ? '+' : ''}`, 'ug');
189189

190190
// Use matchAll to find all matches for the regex in the text, then map to extract the matched strings.
191191
// This approach is streamlined for clarity and performance, directly converting the iterable from matchAll into an array of strings.

0 commit comments

Comments
 (0)