#563·wouter

Custom parser to adapt URLPattern syntax fails

Author: ferbsCreated Apr 17, 2026Updated Sep 5, 2026

Is it possible to pass Router a custom parser function that would work with the WHATWG URLPattern syntax?

I tried modifying Wouter's path-to-regex example but the example relies on parse options not available in URLPattern or path-to-regex v8.x. Eg, the example uses the end parser option to match segments but applying the closest equivalent {/*remainder} fails to match.

Beyond a custom parser function, would it make sense to add a builtin Wouter feature to support the new syntax? Eg, <Router urlpattern> or <Router crapNewSyntax> or somesuch. You wouldn't need to add path-to-regex as a dependency. You could instead mention that the option might require a polyfill. The URLPattern syntax has growing browser support, was added to Node v23.8, and is now being used as default in backend routers like Koa and Express.