search

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit f96ce5706d1ab3f29a0faa00ce4a357807555dc2
parent 5cf34e346727ceb14c92474c52a3d83bd8d27b79
Author: Theo Browne <me@t3.gg>
Date:   Sat, 15 Feb 2025 18:16:14 -0800

Merge pull request #5 from samyakbardiya/fix/handle-non-alphanumeric-chars

fix: Handle non-alphanumeric characters in bangs
Diffstat:
Msrc/main.ts | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 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}}}