arnaucode 112745d6fa | 7 years ago | |
---|---|---|
.. | ||
.npmignore | 7 years ago | |
History.md | 7 years ago | |
Readme.md | 7 years ago | |
component.json | 7 years ago | |
index.js | 7 years ago | |
package.json | 7 years ago | |
test.js | 7 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