arnaucode 112745d6fa | 8 years ago | |
---|---|---|
.. | ||
.npmignore | 8 years ago | |
History.md | 8 years ago | |
Readme.md | 8 years ago | |
component.json | 8 years ago | |
index.js | 8 years ago | |
package.json | 8 years ago | |
test.js | 8 years ago |
Turn an Express-style path string such as /user/:name
into a regular expression.
var pathToRegexp = require('path-to-regexp');
var keys = [];
var exp = pathToRegexp('/foo/:bar', keys);
//keys = ['bar']
//exp = /^\/foo\/(?:([^\/]+?))\/?$/i
You can see a live demo of this library in use at express-route-tester.
MIT