Highlights in excerpts now only work as word prefixes
Less confusing
This commit is contained in:
@@ -70,7 +70,7 @@ export function getAllIndices(text: string, regex: RegExp): SearchMatch[] {
|
|||||||
*/
|
*/
|
||||||
export function stringsToRegex(strings: string[]): RegExp {
|
export function stringsToRegex(strings: string[]): RegExp {
|
||||||
if (!strings.length) return /^$/g
|
if (!strings.length) return /^$/g
|
||||||
const joined = strings.map(s => escapeRegex(s)).join('|')
|
const joined = strings.map(s => '\\b' + escapeRegex(s)).join('|')
|
||||||
const reg = new RegExp(`(${joined})`, 'gi')
|
const reg = new RegExp(`(${joined})`, 'gi')
|
||||||
// console.log(reg)
|
// console.log(reg)
|
||||||
return reg
|
return reg
|
||||||
|
|||||||
Reference in New Issue
Block a user