From a97c511279d32747b487ab5de32677e36a884e53 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Tue, 5 Nov 2024 18:03:10 +0100 Subject: [PATCH] fix(utils): improve `escapeRegExp` function --- src/runtime/utils/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/utils/index.ts b/src/runtime/utils/index.ts index f8d3a525..df351a51 100644 --- a/src/runtime/utils/index.ts +++ b/src/runtime/utils/index.ts @@ -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}`) }