Fix to likely intended regex

This commit is contained in:
Dan Abramov
2024-04-24 01:43:05 +01:00
parent 524d0da034
commit a0f2d7490f
@@ -60,7 +60,7 @@ export function findIndexInText(term: string, text: string) {
// HELLO SENTENCE http://google.com HELLO // HELLO SENTENCE http://google.com HELLO
// http://google.com/ HELLO. // http://google.com/ HELLO.
// http://google.com/. // http://google.com/.
const pattern = new RegExp(`\\b(${escapeRegex(term)})(?!w)`, 'i') const pattern = new RegExp(`\\b(${escapeRegex(term)})(?![/\\w])`, 'i')
const match = pattern.exec(text) const match = pattern.exec(text)
return match ? match.index : -1 return match ? match.index : -1
} }