|
37 | 37 | /this/is/*/pattern |
38 | 38 |
|
39 | 39 | ! The special character '^' can be used to indicate that an URL delimiter such |
40 | | -! as '/' or end-of-url can be matched (note: the number of carets allowed in a |
41 | | -! given instruction is limited): |
| 40 | +! as '/' or end-of-url can be matched. More specifically, '^' is equivalent to |
| 41 | +! the regexp: [^\w\d._%-]|$ |
| 42 | +! |
| 43 | +! This means that it can match either the end of the URL or any character that is |
| 44 | +! not a letter, digit, dot, underscore, percent sign or dash. Here are a few |
| 45 | +! examples of characters that are matched by '^': / (slash), = (equal), |
| 46 | +! [ (bracket), : (colon), etc. |
| 47 | +! |
| 48 | +! In practice, you will usually want to use '/' (or any other specific |
| 49 | +! separator like '=' or '?') most of the time in your patterns, except at the end |
| 50 | +! of a pattern in cases where you want to be a little bit more generic, and |
| 51 | +! express that your pattern should be either matching at the end of the URL or be |
| 52 | +! followed by a separator and then arbitrary URL components. |
| 53 | +! |
| 54 | +! For example, |https://example.org^ will match: 'https://example.org', |
| 55 | +! 'https://example.org/' or 'https://example.org/path'; but it will *not* match |
| 56 | +! 'https://example.org.ac', which is also a valid domain name starting with |
| 57 | +! 'https://example.org'. |
| 58 | +! |
| 59 | +! Another example, /foo.js^ will match: 'https://example.org/foo.js', |
| 60 | +! 'https://example.org/foo.js?param=42', 'https://example.org/foo.js/' but it |
| 61 | +! will *not* match 'https://example.org/foo.jsx' (because it is not followed by a |
| 62 | +! separator). |
| 63 | +! |
| 64 | +! Also note that the maximum number of carets allowed in a given instruction is |
| 65 | +! limited. |
42 | 66 | /this/is/a/pattern^ |
| 67 | +|https://example.org^ |
| 68 | +/foo.js^ |
43 | 69 |
|
44 | 70 | ! By default, a pattern can match anywhere in the URL, but there are specific |
45 | 71 | ! characters which can be used to indicate prefix or suffix matches: we call them |
|
0 commit comments