Open ghost opened 9 years ago
Named capture groups definitely sound like the best approach. I really wish JS supported them natively.
It would also be easy to switch my regex from test()
to exec()
and bind the array to a regex
attribute or multiple named attributes the way you're suggesting.
I'm going to go through what other routers did and see if there are any easy solutions to get named capture groups in-line in the regular expression. Otherwise I'll switch it to exec()
and bind the capture groups.
I think app-router could use regular expressions in order to match path variables. Regex with named captures would be great but Javascript doesn't support them natively (xregexp is a js library that support named captures). Even simple native capture groups (by index number) would be great.
An example:
It's much more powerful than actual path variable data binding (using semicollon like :pathArg1). Thank you for app-router.