From 001e48129b730959b3e841d94bda86e9bc028795 Mon Sep 17 00:00:00 2001 From: Samyak Bardiya Date: Sat, 15 Feb 2025 18:33:21 +0530 Subject: [PATCH] fix: update regex to handle non-alphanumeric chars --- src/main.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.ts b/src/main.ts index c6e00af..7b81419 100644 --- a/src/main.ts +++ b/src/main.ts @@ -55,13 +55,13 @@ function getBangredirectUrl() { return null; } - const match = query.match(/!([a-z0-9]+)/i); + const match = query.match(/!(\S+)/i); const bangCandidate = match?.[1]?.toLowerCase(); const selectedBang = bangs.find((b) => b.t === bangCandidate) ?? defaultBang; // Remove the first bang from the query - const cleanQuery = query.replace(/![a-z0-9]+\s*/i, "").trim(); + const cleanQuery = query.replace(/!\S+\s*/i, "").trim(); // Format of the url is: // https://www.google.com/search?q={{{s}}}