From 6497226dcc0b9e6fdf40ef92c5853b048cb8e8eb Mon Sep 17 00:00:00 2001 From: DarkIntaqt <61588850+DarkIntaqt@users.noreply.github.com> Date: Thu, 21 Mar 2024 13:50:10 +0100 Subject: [PATCH] fix regex issue --- src/module/user/orderChallenges.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/module/user/orderChallenges.js b/src/module/user/orderChallenges.js index 8b4dfd8..26d086d 100644 --- a/src/module/user/orderChallenges.js +++ b/src/module/user/orderChallenges.js @@ -1,7 +1,9 @@ import { checkExists } from "../../func/arrayManipulationFunctions.js" import getChallenge from "../../func/getChallenge"; import { intToTier, tierToInt } from "../../func/tierFunctions"; - +function escapeRegExp(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string +} export function getNextLevel(current, masterOnly = false, pointsOnly = false) { if (masterOnly === true) { @@ -26,6 +28,9 @@ export function removeUnnecessaryChallenges(challengesArray, filters, masterOnly challenges[challenge[0]] = challenge; }) + if (search.length > 0) { + search = escapeRegExp((' ' + search).slice(1)); + } const challengesDetailed = window.JSONPREQUEST || [];