Skip to content

Commit

Permalink
feat(utils): add escapeRegex() function
Browse files Browse the repository at this point in the history
  • Loading branch information
virtual-designer committed Aug 22, 2023
1 parent b6be033 commit 348b338
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,7 @@ export function chunkedString(str: string, chunkSize = 4000) {

return output;
}

export function escapeRegex(string: string) {
return string.replace(/[/\-\\^$*+?.()|[\]{}]/g, "\\$&");
}

0 comments on commit 348b338

Please sign in to comment.