Chrome url match patterns
I can't seem to get the "?" char to match a question mark in a url.
So essentially
"matches": [ "http://www.google.com/search?* ],
will not match
"http://www.google.com/search?cx=c&sourceid=chrome&ie=UTF-8&q=asdf"
Also,
"matches" : [ "http://www.google.com/search*asdf" ],
doesn't match
"http://www.google.com/search?aq=f&cx=c&sourceid=chrome&ie=UTF-8&q=asdf"
This has led me to believe that chrome doesn't consider anything 开发者_如何转开发after the "?". Is this right?
You need to take out the question mark, according to the docs:
"matches": [ "http://www.google.com/search* ],
That will match the request parameters as well.
As an update: using ?
in MatchPatterns is allowed. The current docs for the path state that
<path> := '/' <any chars>
Where
In the path section, each '*' matches 0 or more characters.
See usage at https://github.com/serv-inc/hider/blob/master/addon/manifest.json#L24.
You would have to show us the code you're using to do this matching. If you're using a string search function that takes a regular expression, then you have to escape all regular expression characters if you want them to be searched for as a normal character.
To escape a regular expression character, you would precede it with a backslash like this:
"matches": [ "http://www.google.com/search\?* ],
If you don't want to mess with regular expressions, you can use a non-regex search like .indexOf()
and you won't have to worry about this.
精彩评论