PHANTOM
🇮🇳 IN
Skip to content

Commit 62d5eb5

Browse files
committed
Add better explanation for '^' in patterns
1 parent 33dc06f commit 62d5eb5

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

goggles/quickstart.goggle

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,35 @@
3737
/this/is/*/pattern
3838

3939
! 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.
4266
/this/is/a/pattern^
67+
|https://example.org^
68+
/foo.js^
4369

4470
! By default, a pattern can match anywhere in the URL, but there are specific
4571
! characters which can be used to indicate prefix or suffix matches: we call them

0 commit comments

Comments
 (0)