From 580f8d3cfdf6cc9432d3c972f89bc716243406ba Mon Sep 17 00:00:00 2001 From: Artem Sapegin Date: Fri, 21 Jun 2024 11:19:14 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20Correctly=20handle=20fancy=20quotes=20(`?= =?UTF-8?q?=E2=80=9C=E2=80=9D=E2=80=98=E2=80=99`)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 2 +- test.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index a7272b8..76ea1dd 100644 --- a/index.js +++ b/index.js @@ -133,7 +133,7 @@ function readTermsFile(filepath) { * @param {string} pattern */ function getExactMatchRegExp(pattern) { - const punctuation = '[\\.,;:!?\'")]'; + const punctuation = '[\\.,;:!?\'"’”)]'; return new RegExp( // 1. Beginning of the string, or any character that isn't "-" or alphanumeric // 2. Exact match of the pattern diff --git a/test.js b/test.js index 38c4b8d..c9ef580 100644 --- a/test.js +++ b/test.js @@ -133,6 +133,8 @@ describe('getMultipleWordRegExp', () => { ['Bad (Javascript) is it bad?'], ['Bad "Javascript" is it bad?'], ["Bad 'Javascript' is it bad?"], + ['Bad “Javascript” is it bad?'], + ['Bad ‘Javascript’ is it bad?'], ['Bad "Javascript", is it bad?'], ['Bad Javascript: is this true?'], ['Bad Javascript!'],