From 04bdd27dd08aa6f28d875dce5382e6b4ade3f406 Mon Sep 17 00:00:00 2001 From: Carolina Mitchell Date: Tue, 19 Mar 2024 18:31:26 +1300 Subject: [PATCH] Fix single character alternation in regex --- src/Util/Function/main.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Util/Function/main.ts b/src/Util/Function/main.ts index 2b81b476..7d4e3757 100644 --- a/src/Util/Function/main.ts +++ b/src/Util/Function/main.ts @@ -25,8 +25,8 @@ import { APIUser, OAuth2Scopes } from "discord.js"; import { createRequire } from "module"; export const escapeFormatting = (text: string) => { - const unescaped = text.replace(/\\(\*|_|`|~|\\)/g, "$1"); - return unescaped.replace(/(\*|_|`|~|\\)/g, "\\$1"); + const unescaped = text.replace(/\\([*_`~\\])/g, "$1"); + return unescaped.replace(/([*_`~\\])/g, "\\$1"); }; const require = createRequire(import.meta.url);