fix(utils): improve escapeRegExp function

This commit is contained in:
Benjamin Canac
2024-11-05 18:03:10 +01:00
parent 50cc034796
commit a97c511279

View File

@@ -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}`)
}