我似乎无法得到“?”用于匹配网址中的问号的字符。
基本上
"matches": [ "http://www.google.com/search?* ],
不匹配
"http://www.google.com/search?cx=c&sourceid=chrome&ie=UTF-8&q=asdf"
另外,
"matches" : [ "http://www.google.com/search*asdf" ],
不符合
"http://www.google.com/search?aq=f&cx=c&sourceid=chrome&ie=UTF-8&q=asdf"
这让我相信chrome在“?”之后没有考虑任何事情。这是对的吗?
答案 0 :(得分:2)
答案 1 :(得分:0)
您必须向我们展示您用于执行此匹配的代码。如果您正在使用带有正则表达式的字符串搜索功能,那么如果您希望将它们作为普通字符进行搜索,则必须转义所有正则表达式字符。
要转义正则表达式字符,您应在其前面加上反斜杠:
"matches": [ "http://www.google.com/search\?* ],
如果你不想搞乱正则表达式,你可以使用像.indexOf()
这样的非正则表达式搜索,你不必担心这个。
答案 2 :(得分:0)
作为更新:允许在MatchPatterns中使用worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
gzip on;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
keepalive_timeout 65;
server_tokens off;
client_max_body_size 50M;
server {
listen localhost:8080;
include /etc/nginx/redirects.nginx;
location / {
if ($http_x_forwarded_proto = "http") {
return 301 https://$http_host$request_uri;
}
resolver 172.31.0.2 valid=10s;
set $backend_upstream "http://my-server:80";
proxy_pass $backend_upstream;
proxy_set_header Host $http_host;
}
}
}
。 current docs for the path state that
?
其中
在路径部分,每个' *'匹配0个或更多字符。
请参阅https://github.com/serv-inc/hider/blob/master/addon/manifest.json#L24的使用情况。