diff options
| author | Samyak Bardiya <mail@samyakbardiya.dev> | 2025-02-15 18:33:21 +0530 |
|---|---|---|
| committer | Samyak Bardiya <mail@samyakbardiya.dev> | 2025-02-15 18:33:21 +0530 |
| commit | 001e48129b730959b3e841d94bda86e9bc028795 (patch) | |
| tree | cd5a17572bdec0e9fced9f831f2cd3c19c51a33c /src | |
| parent | 3165c3dccb24f90afc3bcca6b476387a3a87c3a7 (diff) | |
| download | unkagi-001e48129b730959b3e841d94bda86e9bc028795.tar.xz unkagi-001e48129b730959b3e841d94bda86e9bc028795.zip | |
fix: update regex to handle non-alphanumeric chars
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.ts | 4 |
1 files 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}}} |
