Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Readme.md 1.1KB

1234567891011121314151617181920212223242526272829303132333435
  1. # Path-to-RegExp
  2. Turn an Express-style path string such as `/user/:name` into a regular expression.
  3. **Note:** This is a legacy branch. You should upgrade to `1.x`.
  4. ## Usage
  5. ```javascript
  6. var pathToRegexp = require('path-to-regexp');
  7. ```
  8. ### pathToRegexp(path, keys, options)
  9. - **path** A string in the express format, an array of such strings, or a regular expression
  10. - **keys** An array to be populated with the keys present in the url. Once the function completes, this will be an array of strings.
  11. - **options**
  12. - **options.sensitive** Defaults to false, set this to true to make routes case sensitive
  13. - **options.strict** Defaults to false, set this to true to make the trailing slash matter.
  14. - **options.end** Defaults to true, set this to false to only match the prefix of the URL.
  15. ```javascript
  16. var keys = [];
  17. var exp = pathToRegexp('/foo/:bar', keys);
  18. //keys = ['bar']
  19. //exp = /^\/foo\/(?:([^\/]+?))\/?$/i
  20. ```
  21. ## Live Demo
  22. You can see a live demo of this library in use at [express-route-tester](http://forbeslindesay.github.com/express-route-tester/).
  23. ## License
  24. MIT