Skip to content

Commit

Permalink
fix(utils): improve escapeRegExp function
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincanac committed Nov 5, 2024
1 parent 50cc034 commit a97c511
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/runtime/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ export function looseToNumber(val: any): any {
}

export function escapeRegExp(string: string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
return string.replace(/[.*+?^${}()|[\]\\]/g, match => `\\${match}`)
}

0 comments on commit a97c511

Please sign in to comment.