The URLPattern web API matches URLs against a pattern string with named capture groups (:id), wildcards (*), modifiers (? / + / *), and inline regex ((\\d+)). Used by service workers, modern routers, and the View Transitions API. Paste a pattern, paste URLs, and see what matches and what each group captures.
:name for named groups, * for wildcards, optional (...) for inline regex, and modifiers ? / + / * after a group.Instead of matching the whole URL, you can constrain individual parts: protocol, username, password, hostname, port, pathname, search, hash. Leaving these empty defers to the main Pattern field above.
Support: URLPattern is shipped in Chrome 95+, Edge 95+, and Safari 18+. Firefox is implementing it (off by default behind dom.urlpattern.enabled). All matching here runs in your own browser using the native API — falls back to a notice if unavailable.
:name captures one path segment. Access via match.pathname.groups.name.:id(\d+) restricts the group to digits. :slug([a-z0-9-]+) restricts to slug chars.? — optional. :id? matches zero or one segment.+ — one or more segments. :path+ matches multiple /-separated parts (returns a single string with slashes).* — zero or more segments. :rest* matches the tail of a path.* — anonymous match-anything. Accessible as match.pathname.groups[0].{...}: {:y(\d{4})/:m(\d{2})/}?:slug — entire {...} is optional and only applies if all parts match.{ protocol, hostname, port, pathname, search, hash } — each accepts its own pattern syntax.{ pathname: { input, groups }, search: { groups }, ... } — null on miss.