From 2a00f7e8ea69316245825534fb9ee65e35a0938a Mon Sep 17 00:00:00 2001 From: mattpass Date: Sun, 25 Jul 2021 20:06:01 +0100 Subject: [PATCH] Regex simplification and not working with _perms --- lib/multiple-results.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/multiple-results.php b/lib/multiple-results.php index 1029d59..c871233 100644 --- a/lib/multiple-results.php +++ b/lib/multiple-results.php @@ -49,9 +49,9 @@ if (true === isset($_GET['target']) && false !== strpos($_GET['target'], "filena let foundInSelected = false; const userTarget = parent.document.findAndReplace.target.value; const findText = parent.document.findAndReplace.find.value; - const rExp = new RegExp(true === parent.ICEcoder.findRegex ? findText : parent.ICEcoder.escapeRegex(findText), "gi"); + const regexFindText = true === parent.ICEcoder.findRegex ? findText : parent.ICEcoder.escapeRegex(findText); + const rExp = new RegExp("(" + regexFindText + ")", "gi"); parent.ICEcoder.selectedFiles[j].replace(/\|/g, "/").split("/").length && "/" === targetURL.charAt(parent.ICEcoder.selectedFiles[j].length)))) { @@ -122,7 +122,7 @@ if (true === isset($_GET['target']) && false !== strpos($_GET['target'], "filena if (-1 < targetURLElem.parentNode.parentNode.className.indexOf('pft-directory')) { continue; } - const tidiedFileName = targetURLDisplay.replace(/\|/g, "/").replace(/_perms/g, ""); + const tidiedFileName = targetURLDisplay.replace(/\|/g, "/"); resultsDisplay += ')/gi; - resultsDisplay += tidiedFileName.replace(re, '$1') + '
'; + resultsDisplay += tidiedFileName.replace(rExp, '$1') + '
'; // If replacing in filename resultsDisplay += '
' + ' ' + - tidiedFileName.replace(re, "")+'
';