From dadf2b7786d6dc1e2bee9729959579102e953066 Mon Sep 17 00:00:00 2001 From: Melon Mouse <73140350+melonmouse@users.noreply.github.com> Date: Fri, 1 Jan 2021 15:37:09 +0100 Subject: [PATCH] Make regex non-greedy in case eyAi is duplicated There is roughly a 1 in 3000 chance of the magic string "eyAi" appearing more than once in the savegame file (assuming uniform random base64 files of 6KB). In that case, we want the capture group to match the first part only. --- js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index 5dc2367..eaee794 100644 --- a/js/main.js +++ b/js/main.js @@ -9,7 +9,7 @@ $(function(){ var toVal = to.val(); if (fromVal.length > 10 && toVal.length > 10) { var fromCompSave = fromVal.match(/eyAi.*/); - var toCompID = toVal.match(/^(.*)eyAi/); + var toCompID = toVal.match(/^(.*?)eyAi/); if (fromCompSave && toCompID) { result.val(toCompID[1]+fromCompSave[0]); error.hide();