Dieses Repository beinhaltet HTML- und Javascript Code zur einer NotizenWebApp auf Basis von Web Storage. Zudem sind Mocha/Chai Tests im Browser enthalten. https://meinenotizen.netlify.app/
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.markdown 1.5KB

4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # safe-regex
  2. detect potentially
  3. [catastrophic](http://regular-expressions.mobi/catastrophic.html)
  4. [exponential-time](http://perlgeek.de/blog-en/perl-tips/in-search-of-an-exponetial-regexp.html)
  5. regular expressions by limiting the
  6. [star height](https://en.wikipedia.org/wiki/Star_height) to 1
  7. WARNING: This module merely *seems* to work given all the catastrophic regular
  8. expressions I could find scouring the internet, but I don't have enough of a
  9. background in automata to be absolutely sure that this module will catch all
  10. exponential-time cases.
  11. [![browser support](https://ci.testling.com/substack/safe-regex.png)](https://ci.testling.com/substack/safe-regex)
  12. [![build status](https://secure.travis-ci.org/substack/safe-regex.png)](http://travis-ci.org/substack/safe-regex)
  13. # example
  14. ``` js
  15. var safe = require('safe-regex');
  16. var regex = process.argv.slice(2).join(' ');
  17. console.log(safe(regex));
  18. ```
  19. ```
  20. $ node safe.js '(x+x+)+y'
  21. false
  22. $ node safe.js '(beep|boop)*'
  23. true
  24. $ node safe.js '(a+){10}'
  25. false
  26. $ node safe.js '\blocation\s*:[^:\n]+\b(Oakland|San Francisco)\b'
  27. true
  28. ```
  29. # methods
  30. ``` js
  31. var safe = require('safe-regex')
  32. ```
  33. ## var ok = safe(re, opts={})
  34. Return a boolean `ok` whether or not the regex `re` is safe and not possibly
  35. catastrophic.
  36. `re` can be a `RegExp` object or just a string.
  37. If the `re` is a string and is an invalid regex, returns `false`.
  38. * `opts.limit` - maximum number of allowed repetitions in the entire regex.
  39. Default: `25`.
  40. # install
  41. With [npm](https://npmjs.org) do:
  42. ```
  43. npm install safe-regex
  44. ```
  45. # license
  46. MIT