Skip to content

Commit

Permalink
Escape search terms with word boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
mooeypoo committed Apr 18, 2021
1 parent 836e778 commit cb51fdc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/DomManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class DomManager {
// Go over the entire dictionary
this.dictionary.getAllTerms(dictKeyFrom).forEach(term => {
// Create the lookup regular expression
const regex = new RegExp(escapeRegExp(term), 'ig');
const regex = new RegExp(`\\b${escapeRegExp(term)}\\b`, 'ig');

// Look for relevant nodes that may have replacements
xpath.select(
Expand Down

0 comments on commit cb51fdc

Please sign in to comment.