URL Pattern API
4 months ago
- #URLPattern
- #JavaScript
- #WebAPI
- The URL Pattern API defines a syntax for creating URL pattern matchers, available since September 2025.
- Patterns can include literal strings, wildcards, named groups, non-capturing groups, and RegExp groups.
- The syntax is based on path-to-regexp, similar to frameworks like Express or Next.js.
- Patterns can be normalized and support case sensitivity options.
- Examples include filtering URLs by components, using base URLs, and accessing matched group values.
- Supports optional and repeated matching groups with modifiers like ?, +, and *.
- Can use custom prefixes/suffixes with curly braces for more complex patterns.
- Compatible with latest browsers and devices, with limitations on older versions.