Skip to content

Commit

Permalink
fix: Correctly handle fancy quotes (“”‘’)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapegin committed Jun 21, 2024
1 parent 8b48758 commit 580f8d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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!'],
Expand Down

0 comments on commit 580f8d3

Please sign in to comment.