Explorar el Código

fix: RegExp "invalid group specifier name" exception on Safari < 16.4 (#3306, #3371)

WanderingMeow hace 1 año
padre
commit
de3d49000e
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      src/lib/utils/index.ts

+ 1 - 1
src/lib/utils/index.ts

@@ -525,7 +525,7 @@ export const extractSentences = (text) => {
 	});
 
 	// Split the modified text into sentences based on common punctuation marks, avoiding these blocks
-	let sentences = text.split(/(?<=[.!?])\s+/);
+	let sentences = text.match(/[^.?!]+[.!?]+[\])'"`’”]*|.+/g);
 
 	// Restore code blocks and process sentences
 	sentences = sentences.map((sentence) => {