-
Notifications
You must be signed in to change notification settings - Fork 2
/
website_example_url.rule
38 lines (34 loc) · 1.35 KB
/
website_example_url.rule
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
srl: begin with capture (letter once or more) as "protocol", literally "://", capture ( letter once or more, any of (letter, literally ".") once or more, letter at least 2 times ) as "domain", literally ":" optional, capture (digit once or more) as "port" optional, capture (anything never or more) as "path" until (any of (literally "?", must end)), literally "?" optional, capture (anything never or more) as "parameters" optional, must end, case insensitive
match: "https://example.domain.com:1234/a/path?query=param"
match: "http://domain.com?query=param"
match: "http://domain.com/"
match: "http://domain.com"
match: "http://domain/foo/?bar=baz"
no match: "you@example.com"
no match: "domain.com"
no match: "://domain.com"
no match: "http://"
capture for "https://example.domain.com:1234/a/path?query=param":
- 0: protocol: "https"
- 0: domain: "example.domain.com"
- 0: port: "1234"
- 0: path: "/a/path"
- 0: parameters: "query=param"
capture for "https://example.domain.com:1234/a/path":
- 0: protocol: "https"
- 0: domain: "example.domain.com"
- 0: port: "1234"
- 0: path: "/a/path"
- 0: parameters: ""
capture for "protocol://domain/a/path":
- 0: protocol: "protocol"
- 0: domain: "domain"
- 0: port: ""
- 0: path: "/a/path"
- 0: parameters: ""
capture for "http://domain.com":
- 0: protocol: "http"
- 0: domain: "domain.com"
- 0: port: ""
- 0: path: ""
- 0: parameters: ""