From a687a512290c3461ae2b99c1793d558e2d632635 Mon Sep 17 00:00:00 2001 From: FragginWagon Date: Wed, 28 Jan 2026 20:15:13 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Enhance=20search=20highlighting=20b?= =?UTF-8?q?y=20replacing=20regex=20usage=20with=20`replaceAll`=20for=20imp?= =?UTF-8?q?roved=20readability=20and=20consistency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pokedex.online/src/views/GamemasterExplorer.vue | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/code/websites/pokedex.online/src/views/GamemasterExplorer.vue b/code/websites/pokedex.online/src/views/GamemasterExplorer.vue index f380996..5619230 100644 --- a/code/websites/pokedex.online/src/views/GamemasterExplorer.vue +++ b/code/websites/pokedex.online/src/views/GamemasterExplorer.vue @@ -411,11 +411,9 @@ function getHighlightedContent(lineContent) { if (!searchQuery.value.trim()) return lineContent; const searchTerm = searchQuery.value; - const regex = new RegExp( - `(${searchTerm.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')})`, - 'gi' - ); - return lineContent.replace(regex, '$1'); + const escapedTerm = searchTerm.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`); + const regex = new RegExp(`(${escapedTerm})`, 'gi'); + return lineContent.replaceAll(regex, '$1'); } // URL state sync