{"name":"safe-regex2","version":"4.0.0","description":"detect possibly catastrophic, exponential-time regular expressions","main":"index.js","type":"commonjs","types":"types/index.d.ts","dependencies":{"ret":"~0.5.0"},"devDependencies":{"@fastify/pre-commit":"^2.1.0","c8":"^7.14.0","standard":"^17.1.0","tape":"^5.7.5","tsd":"^0.31.0"},"scripts":{"lint":"standard","test":"npm run test:unit && npm run test:typescript","test:typescript":"tsd","test:unit":"c8 tape test/*.js"},"repository":{"type":"git","url":"git://github.com/fastify/safe-regex.git"},"homepage":"https://github.com/fastify/safe-regex","keywords":["catastrophic","exponential","regex","safe","sandbox"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"contributors":[{"name":"Matteo Collina","email":"hello@matteocollina.com"}],"license":"MIT","_id":"safe-regex2@4.0.0","gitHead":"90e7177a45e993203898398c77b2f087d1dc23d8","bugs":{"url":"https://github.com/fastify/safe-regex/issues"},"_nodeVersion":"20.15.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-Hvjfv25jPDVr3U+4LDzBuZPPOymELG3PYcSk5hcevooo1yxxamQL/bHs/GrEPGmMoMEwRrHVGiCA1pXi97B8Ew==","shasum":"5e04d8362cd4884753c8bce9715d4759a5239c0a","tarball":"http://registry-npm.ywwl.com/safe-regex2/download/safe-regex2-4.0.0.tgz","fileCount":12,"unpackedSize":7936,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIETHOWpmb3B5M2LVjPMpM28ftJYioiqCEyJz6TmahY4WAiEAkZgr5igxWK1GVv1STX56Yw6OIrwcODrZRK7ChvO54OE="}],"size":3837,"noattachment":false,"key":"/safe-regex2/-/safe-regex2-4.0.0.tgz"},"_npmUser":{"name":"jsumners","email":"james.sumners@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/safe-regex2_4.0.0_1720787112994_0.7491400192400415"},"_hasShrinkwrap":false,"readme":"# safe-regex2\n\ndetect potentially\n[catastrophic](http://regular-expressions.mobi/catastrophic.html)\n[exponential-time](http://perlgeek.de/blog-en/perl-tips/in-search-of-an-exponetial-regexp.html)\nregular expressions by limiting the\n[star height](https://en.wikipedia.org/wiki/Star_height) to 1\n\nThis is a fork of https://github.com/substack/safe-regex at 1.1.0.\n\nWARNING: This module has both false positives and false negatives.\nIt is not meant as a full checker, but it detect basic cases.\n\n# example\n\n``` js\nvar safe = require('safe-regex2');\nvar regex = process.argv.slice(2).join(' ');\nconsole.log(safe(regex));\n```\n\n```\n$ node safe.js '(x+x+)+y'\nfalse\n$ node safe.js '(beep|boop)*'\ntrue\n$ node safe.js '(a+){10}'\nfalse\n$ node safe.js '\\blocation\\s*:[^:\\n]+\\b(Oakland|San Francisco)\\b'\ntrue\n```\n\n# methods\n\n``` js\nvar safe = require('safe-regex')\n```\n\n## var ok = safe(re, opts={})\n\nReturn a boolean `ok` whether or not the regex `re` is safe and not possibly\ncatastrophic.\n\n`re` can be a `RegExp` object or just a string.\n\nIf the `re` is a string and is an invalid regex, returns `false`.\n\n* `opts.limit` - maximum number of allowed repetitions in the entire regex.\nDefault: `25`.\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install safe-regex2\n```\n\n# license\n\nMIT\n","publish_time":1720787113129,"maintainers":[{"name":"jsumners","email":"james.sumners@gmail.com"},{"name":"climba03003","email":"kaka@kakawebsitedemo.com"},{"name":"gurgunday","email":"hey@gurgun.day"},{"name":"simoneb","email":"simone.busoli@gmail.com"},{"name":"ivan-tymoshenko","email":"ivan@tymoshenko.me"},{"name":"eomm","email":"behemoth89@gmail.com"},{"name":"zekth","email":"vince.legoff@gmail.com"},{"name":"rafaelgss","email":"rafael.nunu@hotmail.com"},{"name":"matteo.collina","email":"hello@matteocollina.com"}],"_cnpm_publish_time":1720787113129,"dist-tags":{"latest":"5.1.2"}}