انتقل إلى المحتوى

لم تُترجم هذه الصفحة بعد، لذا تُعرض بالإنجليزية.

URLPattern

How Elide supports the URLPattern global for matching URLs against patterns per the URL Pattern Standard, including ignoreCase and hasRegExpGroups.

اقرأ دون اتصالelide help api-whatwg-urlpattern

في هذه الصفحة
الاستخدام مع الذكاء الاصطناعي
افتح في ChatGPTافتح في Claudeالاتصال عبر MCP

URLPattern is a global and follows the URL Pattern Standard, including the ignoreCase option and hasRegExpGroups.

Example

js
// urlpattern.mjs
const route = new URLPattern({ pathname: "/users/:id(\\d+)/:tab?" });

console.log(route.test("https://example.com/users/42"));
console.log(JSON.stringify(route.exec("https://example.com/users/42/posts").pathname.groups));
console.log(route.test("https://example.com/users/alice"));
utf-8 · js · Lines: 6

elide run urlpattern.mjs prints:

text
true
{"tab":"posts","id":"42"}
false
utf-8 · text · Lines: 3

Samples

Reference

Status: Full · Not measured · since 1.1.0

Exports

Export Kind Status Notes
URLPattern class Full protocol, username, password, hostname, port, pathname, search, hash, hasRegExpGroups, test(), exec()

هل كانت هذه الصفحة مفيدة؟