erikringsmuth / app-router

Router for Web Components
https://erikringsmuth.github.io/app-router/
MIT License
611 stars 83 forks source link

regex matching #6

Closed erikringsmuth closed 10 years ago

erikringsmuth commented 10 years ago

It'd be great to be able to match using regular expressions.

Example: match a pattern like '/word/number'

<app-route path="/^\/\w+\/\d+$/i" regex import="/page/cust-el.html"></app-route>

The issue is escaping the regular expression string in the HTML. Also how would it be called from JS?

route.setAttribute('regex', 'regex');
route.setAttribute('path', /^\/\w+\/\d+$/i);
erikringsmuth commented 10 years ago

RegExp pattern matching is in place as of commit https://github.com/erikringsmuth/app-router/commit/64575423a4eb58e078bc07a163ca625e36211a61!

Documentation: https://github.com/erikringsmuth/app-router#regular-expressions