diff options
| author | Serghei Iakovlev <egrep@protonmail.ch> | 2022-07-30 22:45:04 +0200 |
|---|---|---|
| committer | Serghei Iakovlev <egrep@protonmail.ch> | 2022-07-30 22:45:04 +0200 |
| commit | 4f57fb0152e8de062f990e36dd6417174bef6700 (patch) | |
| tree | f4bf4bbb9075d9d8536c920c6a8ecdc86b12174c /assets | |
| parent | ccfac4e2978d4e2efedecf5200070a693ff01db4 (diff) | |
| download | gohugo-theme-ed-4f57fb0152e8de062f990e36dd6417174bef6700.tar.gz | |
Use RegExp class to specify sentence boundary
Diffstat (limited to 'assets')
| -rw-r--r-- | assets/js/search.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/assets/js/search.js b/assets/js/search.js index 2dc5eaa..f37e15b 100644 --- a/assets/js/search.js +++ b/assets/js/search.js @@ -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), |
