fix: update regex to handle non-alphanumeric chars
This commit is contained in:
parent
3165c3dccb
commit
001e48129b
@ -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}}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user