Skip to content

Commit

Permalink
Skip hyphens '-' when converting matches in glossary conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
zoglo committed Jun 2, 2023
1 parent 5040430 commit ea21953
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Resources/public/scripts/Glossary.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export class Glossary
// Lookbehind in JS regular expressions ( ?>= ) : https://caniuse.com/js-regexp-lookbehind
if (this.isNewIE)
{
const matchRgx = new RegExp("(?:>|^|\\()(" + match + ")\\b", 'gu')
const matchRgx = new RegExp("(?:>|^|\\()(" + match + ")(?!\-)\\b", 'gu')
let sentence = []

for (let word of node.textContent.split(' '))
Expand All @@ -232,7 +232,7 @@ export class Glossary
else
{
// Lookbehind regex for other browsers
const matchRgx = new RegExp("(?<!glc=\"1\">)(?<=\\s|>|^|\\()(" + match + ")\\b", 'gu')
const matchRgx = new RegExp("(?<!glc=\"1\">)(?<=\\s|>|^|\\()(" + match + ")(?!\-)\\b", 'gu')

if (matchRgx.test(node.textContent))
{
Expand Down
Loading

0 comments on commit ea21953

Please sign in to comment.