Source code

Revision control

Copy as Markdown

Other Tools

[
{
"pattern": { "pathname": "/foo" },
"component": "invalid",
"groups": {},
"expected": null
},
{
"pattern": { "pathname": "/foo" },
"component": "pathname",
"groups": {},
"expected": "/foo"
},
{
"pattern": { "pathname": "/:foo" },
"component": "pathname",
"groups": { "foo": "bar" },
"expected": "/bar"
},
{
"pattern": { "pathname": "/:foo" },
"component": "pathname",
"groups": { "foo": "🍅" },
"expected": "/%F0%9F%8D%85"
},
{
"pattern": { "hostname": "{:foo}.example.com" },
"component": "hostname",
"groups": { "foo": "🍅" },
"expected": "xn--fi8h.example.com"
},
{
"pattern": { "pathname": "/:foo" },
"component": "pathname",
"groups": {},
"expected": null
},
{
"pattern": { "pathname": "/foo/:bar" },
"component": "pathname",
"groups": { "bar": "baz" },
"expected": "/foo/baz"
},
{
"pattern": { "pathname": "/foo:bar" },
"component": "pathname",
"groups": { "bar": "baz" },
"expected": "/foobaz"
},
{
"pattern": { "pathname": "/:foo/:bar" },
"component": "pathname",
"groups": { "foo": "baz", "bar": "qux" },
"expected": "/baz/qux"
},
{
"pattern": "https://example.com/:foo",
"component": "pathname",
"groups": { "foo": " " },
"expected": "/%20"
},
{
"component": "pathname",
"groups": { "foo": " " },
"expected": "/ "
},
{
"pattern": { "pathname": "/:foo" },
"component": "pathname",
"groups": { "foo": "bar/baz" },
"expected": null
},
{
"pattern": { "pathname": "*" },
"component": "pathname",
"groups": {},
"expected": null
},
{
"pattern": { "pathname": "/{foo}+" },
"component": "pathname",
"groups": {},
"expected": null
},
{
"pattern": { "pathname": "/{foo}?" },
"component": "pathname",
"groups": {},
"expected": null
},
{
"pattern": { "pathname": "/{foo}*" },
"component": "pathname",
"groups": {},
"expected": null
},
{
"pattern": { "pathname": "/(regexp)" },
"component": "pathname",
"groups": {},
"expected": null
},
{
"pattern": { "pathname": "/([^\\/]+?)" },
"component": "pathname",
"groups": {},
"expected": null
},
{
"pattern": { "port": "([^\\:]+?)" },
"component": "port",
"groups": {},
"expected": null
}
]