| OLD | NEW |
| 1 <div id="pageData-name" class="pageData">Match Patterns</div> | 1 <div id="pageData-name" class="pageData">Match Patterns</div> |
| 2 | 2 |
| 3 <p> | 3 <p> |
| 4 <a href="content_scripts.html">Content scripts</a> operate on | 4 <a href="content_scripts.html">Content scripts</a> operate on |
| 5 a set of URLs defined by match patterns. | 5 a set of URLs defined by match patterns. |
| 6 You can put one or more match patterns | 6 You can put one or more match patterns |
| 7 in the <code>"matches"</code> part of | 7 in the <code>"matches"</code> part of |
| 8 a content script's section of the manifest. | 8 a content script's section of the manifest. |
| 9 This page describes the match pattern syntax — | 9 This page describes the match pattern syntax — |
| 10 the rules you need to follow when you specify | 10 the rules you need to follow when you specify |
| 11 which URLs your content script affects. | 11 which URLs your content script affects. |
| 12 </p> | 12 </p> |
| 13 | 13 |
| 14 <p> | 14 <p> |
| 15 A match pattern is essentially a URL | 15 A match pattern is essentially a URL |
| 16 that begins with <code>http</code>, <code>https</code>, | 16 that begins with a permitted scheme (<code>http</code>, |
| 17 <code>file</code>, or <code>ftp</code>, | 17 <code>https</code>, <code>file</code>, or <code>ftp</code>), |
| 18 and that can contain '<code>*</code>' characters. | 18 and that can contain '<code>*</code>' characters. |
| 19 The special pattern |
| 20 <code><all_urls></code> matches any URL |
| 21 that starts with a permitted scheme. |
| 19 Each match pattern has 3 parts:</p> | 22 Each match pattern has 3 parts:</p> |
| 20 </p> | 23 </p> |
| 21 | 24 |
| 22 <ul> | 25 <ul> |
| 23 <li> <em>scheme</em> — | 26 <li> <em>scheme</em> — |
| 24 for example, <code>http</code> or <code>file</code> | 27 for example, <code>http</code> or <code>file</code> |
| 28 or <code>*</code> |
| 25 </li> | 29 </li> |
| 26 <li> <em>host</em> — | 30 <li> <em>host</em> — |
| 27 for example, <code>www.google.com</code> | 31 for example, <code>www.google.com</code> |
| 28 or <code>*.google.com</code> | 32 or <code>*.google.com</code> |
| 29 or <code>*</code>; | 33 or <code>*</code>; |
| 30 if the scheme is <code>file</code>, | 34 if the scheme is <code>file</code>, |
| 31 there is no <em>host</em> part | 35 there is no <em>host</em> part |
| 32 </li> | 36 </li> |
| 33 <li> <em>path</em> — | 37 <li> <em>path</em> — |
| 34 for example, <code>/*</code>, <code>/foo* </code>, | 38 for example, <code>/*</code>, <code>/foo* </code>, |
| 35 or <code>/foo/bar </code> | 39 or <code>/foo/bar </code> |
| 36 </li> | 40 </li> |
| 37 </ul> | 41 </ul> |
| 38 | 42 |
| 39 <p>Here's the basic syntax:</p> | 43 <p>Here's the basic syntax:</p> |
| 40 | 44 |
| 41 <pre><em><url-pattern></em> := <em><scheme></em>://<em><host><
/em><em><path></em><br><em><scheme></em> := 'http' | 'https' | 'file
' | 'ftp'<br><em><host></em> := '*' | '*.' <em><any char except '/' and
'*'></em>+<br><em><path></em> := '/' <em><any chars></em></pre> | 45 <pre> |
| 46 <em><url-pattern></em> := <em><scheme></em>://<em><host></em><
em><path></em> |
| 47 <em><scheme></em> := '*' | 'http' | 'https' | 'file' | 'ftp' |
| 48 <em><host></em> := '*' | '*.' <em><any char except '/' and '*'></em>
+ |
| 49 <em><path></em> := '/' <em><any chars></em> |
| 50 </pre> |
| 42 | 51 |
| 43 <p> | 52 <p> |
| 44 The meaning of '<code>*</code>' depends on whether | 53 The meaning of '<code>*</code>' depends on whether |
| 45 it's in the <em>host</em> or the <em>path</em> part. | 54 it's in the <em>scheme</em>, <em>host</em>, or <em>path</em> part. |
| 55 If the <em>scheme</em> is <code>*</code>, |
| 56 then it matches either <code>http</code> or <code>https</code>. |
| 46 If the <em>host</em> is just <code>*</code>, | 57 If the <em>host</em> is just <code>*</code>, |
| 47 then it matches any host. | 58 then it matches any host. |
| 48 If the <em>host</em> is <code>*.<em>hostname</em></code>, | 59 If the <em>host</em> is <code>*.<em>hostname</em></code>, |
| 49 then it matches the specified host or any of its subdomains. | 60 then it matches the specified host or any of its subdomains. |
| 50 In the <em>path</em> section, | 61 In the <em>path</em> section, |
| 51 each '<code>*</code>' matches 0 or more characters. | 62 each '<code>*</code>' matches 0 or more characters. |
| 52 The following table shows some valid patterns. | 63 The following table shows some valid patterns. |
| 53 </p> | 64 </p> |
| 54 | 65 |
| 55 <table class="columns"> | 66 <table class="columns"> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 151 |
| 141 <td> | 152 <td> |
| 142 Matches any URL that uses the <code>http</code> scheme | 153 Matches any URL that uses the <code>http</code> scheme |
| 143 and is on the host 127.0.0.1 | 154 and is on the host 127.0.0.1 |
| 144 </td> | 155 </td> |
| 145 <td> | 156 <td> |
| 146 http://127.0.0.1/<br> | 157 http://127.0.0.1/<br> |
| 147 http://127.0.0.1/foo/bar.html | 158 http://127.0.0.1/foo/bar.html |
| 148 </td> | 159 </td> |
| 149 </tr> | 160 </tr> |
| 161 |
| 162 <tr> |
| 163 <td> |
| 164 <code>*://mail.google.com/* </code> |
| 165 </td> |
| 166 |
| 167 <td> |
| 168 Matches any URL that starts with |
| 169 <code>http://mail.google.com</code> or |
| 170 <code>https://mail.google.com</code>. |
| 171 </td> |
| 172 |
| 173 <td> |
| 174 http://mail.google.com/foo/baz/bar<br> |
| 175 https://mail.google.com/foobar |
| 176 </td> |
| 177 </tr> |
| 178 |
| 179 <tr> |
| 180 <td> |
| 181 <code><all_urls></code> |
| 182 </td> |
| 183 |
| 184 <td> |
| 185 Matches any URL that uses a permitted scheme. |
| 186 (See the beginning of this section for the list of permitted |
| 187 schemes.) |
| 188 </td> |
| 189 <td> |
| 190 http://example.org/foo/bar.html<br> |
| 191 file:///bar/baz.html |
| 192 </td> |
| 193 </tr> |
| 150 </tbody> | 194 </tbody> |
| 151 </table> | 195 </table> |
| 152 | 196 |
| 153 <p> | 197 <p> |
| 154 Here are some examples of <em>invalid</em> pattern matches: | 198 Here are some examples of <em>invalid</em> pattern matches: |
| 155 </p> | 199 </p> |
| 156 | 200 |
| 157 <table class="columns"> | 201 <table class="columns"> |
| 158 <tbody> | 202 <tbody> |
| 159 <tr> | 203 <tr> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 181 <td>Missing <em>scheme</em> separator ("/" should be "//")</td> | 225 <td>Missing <em>scheme</em> separator ("/" should be "//")</td> |
| 182 </tr> | 226 </tr> |
| 183 | 227 |
| 184 <tr> | 228 <tr> |
| 185 <td><code>foo://*</code></td> | 229 <td><code>foo://*</code></td> |
| 186 <td>Invalid <em>scheme</em></td> | 230 <td>Invalid <em>scheme</em></td> |
| 187 </tr> | 231 </tr> |
| 188 </tbody> | 232 </tbody> |
| 189 </table> | 233 </table> |
| 190 | 234 |
| OLD | NEW |