diff --git a/src/utils/patches.ts b/src/utils/patches.ts index 979e49fd7..c5bd81205 100644 --- a/src/utils/patches.ts +++ b/src/utils/patches.ts @@ -24,8 +24,7 @@ export function canonicalizeMatch(match: T): T { } const canonRegex = new RegExp(match.source.replaceAll(String.raw`\i`, String.raw`(?:[A-Za-z_$][\w$]*)`), match.flags); - const originalToString = canonRegex.toString.bind(canonRegex); - canonRegex.toString = () => originalToString().replaceAll(String.raw`(?:[A-Za-z_$][\w$]*)`, String.raw`\i`); + canonRegex.toString = match.toString.bind(match); return canonRegex as T; }