ForbesLindesay / express-route-tester

Attempts to give you an idea of what urls will be accepted by an express route (please fork and extend it)

Home Page:http://forbeslindesay.github.com/express-route-tester/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No support for regex routes

jolyonruss opened this issue · comments

If I paste the example regex route from http://expressjs.com/guide/routing.html

/.*fly$/

into the route tester and /fly/ into the path field I don't get any matches.

When I tried that route in my app it works.

I suspect this is due to non-regex routes being wrapped as a 'string'

I just went through troubleshooting an issue in a project I'm working on where this tool would have worked wonders. Unfortunately this lack of support meant I had to look elsewhere. I hope in future regex routes are supported, or at the very least a disclaimer should state lack of support.

The whole idea of this tester is to see how string-based patterns work and how they are compiled to a regex. Using a regex directly completely defeats the purpose.
There are plenty of general regex testers around that you can use instead if you want.

That said, you can get some degree of regex-like functionality with string patterns as well - just use brackets around the regex subpatterns.

Mmmm... I would to test my regex patterns as well. It's true, there are lot of other tools, but I found this useful to test express routes and I'd like to use it as the single tool to test routes.