Use RegExp class to specify sentence boundary

This commit is contained in:
Serghei Iakovlev 2022-07-30 22:45:04 +02:00
parent ccfac4e297
commit 4f57fb0152
No known key found for this signature in database
GPG key ID: C6AF1016BBDEA800

View file

@ -156,7 +156,7 @@ function createSearchResultBlurb(query, pageContent) {
// term, we need a way to identify where each sentence begins/ends. This
// regex will be used to produce a list of all sentences from the page
// content.
const sentenceBoundaryRegex = /\b\.\s/gm;
const sentenceBoundaryRegex = new RegExp('\\b\\.\\s', 'gm');
const searchQueryHits = Array.from(
pageContent.matchAll(searchQueryRegex),