Skip to content

Commit 5bf1e2b

Browse files
committed
Make the example easier
1 parent 2a9681d commit 5bf1e2b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ It's a thin wrapper of [denoland/rust-urlpattern](https://github.com/denoland/ru
1818
```py
1919
from urlpattern import URLPattern
2020

21-
pattern = URLPattern("https://example.com/*")
22-
print(pattern.test("https://example.com/foo/bar")) # output: True
21+
pattern = URLPattern("https://example.com/admin/*")
22+
print(pattern.test("https://example.com/admin/main/")) # output: True
23+
print(pattern.test("https://example.com/main/")) # output: False
2324

24-
pattern = URLPattern({"pathname": "/:foo/:bar"})
25-
result = pattern.exec("/abc/def", "https://test.example")
26-
print(result["pathname"]["groups"]["foo"]) # output: abc
27-
print(result["pathname"]["groups"]["bar"]) # output: def
25+
pattern = URLPattern({"pathname": "/users/:id/"})
26+
result = pattern.exec({"pathname": "/users/4163/"})
27+
print(result["pathname"]["groups"]["id"]) # output: 4163
2828
```
2929

3030
## Installation

0 commit comments

Comments
 (0)