Skip to content

Commit

Permalink
Merge pull request #5 from sereneinserenade/4-bug-regex-fails-on-trai…
Browse files Browse the repository at this point in the history
…ling-dashes

fix: bug regex fails on trailing dashes
  • Loading branch information
sereneinserenade authored Jan 12, 2024
2 parents d630bc9 + cfc1073 commit eecbef7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions demos/vue/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion demos/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"preview": "vite preview"
},
"dependencies": {
"@sereneinserenade/tiptap-search-and-replace": "^0.0.2",
"@sereneinserenade/tiptap-search-and-replace": "^0.0.3",
"@tiptap/extension-link": "^2.1.8",
"@tiptap/starter-kit": "^2.0.0-beta.209",
"@tiptap/vue-3": "^2.0.0-beta.209",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sereneinserenade/tiptap-search-and-replace",
"version": "0.0.2",
"version": "0.0.3",
"description": "Tiptap Extension for adding comments",
"keywords": [
"tiptap-search-and-replace-extension",
Expand Down
2 changes: 1 addition & 1 deletion src/searchAndReplace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ interface TextNodesWithPosition {
}

const getRegex = (s: string, disableRegex: boolean, caseSensitive: boolean): RegExp => {
return RegExp(disableRegex ? s.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&") : s, caseSensitive ? "gu" : "gui")
return RegExp(disableRegex ? s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') : s, caseSensitive ? "gu" : "gui");
}

interface ProcessedSearches {
Expand Down

0 comments on commit eecbef7

Please sign in to comment.