| OLD | NEW |
| 1 <h1>Match Patterns</h1> | 1 <h1>Match Patterns</h1> |
| 2 | 2 |
| 3 <p> | 3 <p> |
| 4 <a href="declare_permissions#host-permissions">Host | 4 <a href="declare_permissions#host-permissions">Host |
| 5 permissions</a> | 5 permissions</a> |
| 6 {{^is_apps}} | 6 {{^is_apps}} |
| 7 and <a href="content_scripts">content script</a> | 7 and <a href="content_scripts">content script</a> |
| 8 {{/is_apps}} | 8 {{/is_apps}} |
| 9 matching {{^is_apps}}are{{:}}is{{/is_apps}} based on a set of URLs defined by | 9 matching {{^is_apps}}are{{:}}is{{/is_apps}} based on a set of URLs defined by |
| 10 <dfn>match patterns</dfn>. A match pattern is essentially a | 10 <dfn>match patterns</dfn>. A match pattern is essentially a |
| 11 URL that begins with a permitted scheme (<code>http</code>, | 11 URL that begins with a permitted scheme (<code>http</code>, |
| 12 <code>https</code>, <code>file</code>, <code>ftp</code>, or | 12 <code>https</code>, <code>file</code>, or <code>ftp</code>, |
| 13 <code>chrome-extension</code>), | |
| 14 and that can contain '<code>*</code>' characters. | 13 and that can contain '<code>*</code>' characters. |
| 15 The special pattern | 14 The special pattern |
| 16 <code><all_urls></code> matches any URL | 15 <code><all_urls></code> matches any URL |
| 17 that starts with a permitted scheme. | 16 that starts with a permitted scheme. |
| 18 Each match pattern has 3 parts:</p> | 17 Each match pattern has 3 parts:</p> |
| 19 </p> | 18 </p> |
| 20 | 19 |
| 21 <ul> | 20 <ul> |
| 22 <li> <em>scheme</em> — | 21 <li> <em>scheme</em> — |
| 23 for example, <code>http</code> or <code>file</code> | 22 for example, <code>http</code> or <code>file</code> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 41 or <code>/foo/bar</code>. The path must be present in a | 40 or <code>/foo/bar</code>. The path must be present in a |
| 42 host permission, but is always treated | 41 host permission, but is always treated |
| 43 as <code>/*</code>. | 42 as <code>/*</code>. |
| 44 </li> | 43 </li> |
| 45 </ul> | 44 </ul> |
| 46 | 45 |
| 47 <p>Here's the basic syntax:</p> | 46 <p>Here's the basic syntax:</p> |
| 48 | 47 |
| 49 <pre> | 48 <pre> |
| 50 <em><url-pattern></em> := <em><scheme></em>://<em><host></em><
em><path></em> | 49 <em><url-pattern></em> := <em><scheme></em>://<em><host></em><
em><path></em> |
| 51 <em><scheme></em> := '*' | 'http' | 'https' | 'file' | 'ftp' | 'chrome-ext
ension' | 50 <em><scheme></em> := '*' | 'http' | 'https' | 'file' | 'ftp' |
| 52 <em><host></em> := '*' | '*.' <em><any char except '/' and '*'></em>
+ | 51 <em><host></em> := '*' | '*.' <em><any char except '/' and '*'></em>
+ |
| 53 <em><path></em> := '/' <em><any chars></em> | 52 <em><path></em> := '/' <em><any chars></em> |
| 54 </pre> | 53 </pre> |
| 55 | 54 |
| 56 <p> | 55 <p> |
| 57 The meaning of '<code>*</code>' depends on whether | 56 The meaning of '<code>*</code>' depends on whether |
| 58 it's in the <em>scheme</em>, <em>host</em>, or <em>path</em> part. | 57 it's in the <em>scheme</em>, <em>host</em>, or <em>path</em> part. |
| 59 If the <em>scheme</em> is <code>*</code>, | 58 If the <em>scheme</em> is <code>*</code>, |
| 60 then it matches either <code>http</code> or <code>https</code>, | 59 then it matches either <code>http</code> or <code>https</code>, |
| 61 and <strong>not</strong> <code>file</code>, <code>ftp</code>, | 60 and <strong>not</strong> <code>file</code>, or <code>ftp</code>. |
| 62 or <code>chrome-extension</code>. | |
| 63 If the <em>host</em> is just <code>*</code>, | 61 If the <em>host</em> is just <code>*</code>, |
| 64 then it matches any host. | 62 then it matches any host. |
| 65 If the <em>host</em> is <code>*.<em>hostname</em></code>, | 63 If the <em>host</em> is <code>*.<em>hostname</em></code>, |
| 66 then it matches the specified host or any of its subdomains. | 64 then it matches the specified host or any of its subdomains. |
| 67 In the <em>path</em> section, | 65 In the <em>path</em> section, |
| 68 each '<code>*</code>' matches 0 or more characters. | 66 each '<code>*</code>' matches 0 or more characters. |
| 69 The following table shows some valid patterns. | 67 The following table shows some valid patterns. |
| 70 </p> | 68 </p> |
| 71 | 69 |
| 72 <table class="simple"> | 70 <table class="simple"> |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 </td> | 176 </td> |
| 179 | 177 |
| 180 <td> | 178 <td> |
| 181 http://mail.google.com/foo/baz/bar<br> | 179 http://mail.google.com/foo/baz/bar<br> |
| 182 https://mail.google.com/foobar | 180 https://mail.google.com/foobar |
| 183 </td> | 181 </td> |
| 184 </tr> | 182 </tr> |
| 185 | 183 |
| 186 <tr> | 184 <tr> |
| 187 <td> | 185 <td> |
| 188 <code>chrome-extension://*/* </code> | |
| 189 </td> | |
| 190 | |
| 191 <td> | |
| 192 Matches any URL pointing to an extension (the first <code>*</code> | |
| 193 represents a filter for extension IDs, the second for paths). | |
| 194 </td> | |
| 195 | |
| 196 <td> | |
| 197 chrome-extension://askla...asdf/options.html | |
| 198 </td> | |
| 199 </tr> | |
| 200 | |
| 201 <tr> | |
| 202 <td> | |
| 203 <code><all_urls></code> | 186 <code><all_urls></code> |
| 204 </td> | 187 </td> |
| 205 | 188 |
| 206 <td> | 189 <td> |
| 207 Matches any URL that uses a permitted scheme. | 190 Matches any URL that uses a permitted scheme. |
| 208 (See the beginning of this section for the list of permitted | 191 (See the beginning of this section for the list of permitted |
| 209 schemes.) | 192 schemes.) |
| 210 </td> | 193 </td> |
| 211 <td> | 194 <td> |
| 212 http://example.org/foo/bar.html<br> | 195 http://example.org/foo/bar.html<br> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 <tr> | 233 <tr> |
| 251 <td><code>foo://*</code></td> | 234 <td><code>foo://*</code></td> |
| 252 <td>Invalid <em>scheme</em></td> | 235 <td>Invalid <em>scheme</em></td> |
| 253 </tr> | 236 </tr> |
| 254 </tbody> | 237 </tbody> |
| 255 </table> | 238 </table> |
| 256 | 239 |
| 257 <p> | 240 <p> |
| 258 Some schemes are not supported in all contexts. | 241 Some schemes are not supported in all contexts. |
| 259 </p> | 242 </p> |
| OLD | NEW |