{"name":"cidr-regex","version":"4.0.3","description":"Regular expression for matching IP addresses in CIDR notation","author":{"name":"silverwind","email":"me@silverwind.io"},"contributors":[{"name":"Felipe Apostol","email":"flipjs.io@gmail.com","url":"http://flipjs.io/"}],"repository":{"type":"git","url":"git+https://github.com/silverwind/cidr-regex.git"},"license":"BSD-2-Clause","type":"module","exports":"./index.js","sideEffects":false,"engines":{"node":">=14"},"dependencies":{"ip-regex":"^5.0.0"},"devDependencies":{"eslint":"8.37.0","eslint-config-silverwind":"65.1.3","tsd":"0.28.1","updates":"13.2.9","versions":"10.4.2","vitest":"0.29.8"},"types":"./index.d.ts","gitHead":"c13387acf04558ee103dd20cc24551beb8b8b142","bugs":{"url":"https://github.com/silverwind/cidr-regex/issues"},"homepage":"https://github.com/silverwind/cidr-regex#readme","_id":"cidr-regex@4.0.3","_nodeVersion":"19.7.0","_npmVersion":"9.6.2","dist":{"integrity":"sha512-HOwDIy/rhKeMf6uOzxtv7FAbrz8zPjmVKfSpM+U7/bNBXC5rtOyr758jxcptiSx6ZZn5LOhPJT5WWxPAGDV8dw==","shasum":"07b52c9762d1ff546a50740e92fc2b5b13a6d871","tarball":"http://registry-npm.ywwl.com/cidr-regex/download/cidr-regex-4.0.3.tgz","fileCount":5,"unpackedSize":5802,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF1H0UFJFQxHcdD/TaUmgyovGVuK+R429G6sYX0quOqvAiEA44ClEGu96ryn3BwXR9JMWB/QFunSUBCI36cxapERkKI="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkJd/IACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpE4w/7B7fSeHfimHfXQ8vsJX9WVGP3BVzJZ8nK4xi8KvYM/K5VnPf0\r\nBB5bFMMiDqM34JiaXrtn+OXvQt6WBBI+cinHYcKsQ9zOBPAArSK/Oy0NPyGl\r\nL0wMHVFmAGkosUTakz+YJqgLAHK9Sw1eaS/XcAz1GBNRRnWdZdrzcWD/2qPI\r\nBsBpLlQeD/8+0YV9asOaVj4WXeFjFTRtKB0OUEF8cVBobV5Q9Njtt4qSKr6r\r\nNd6RdnUYJqWTjxbwwphusr5heQupltJZvm9DXpOqjFKbxuBuv1hga/bYcRmJ\r\ngyVY0eWNBJEIxbJ1Kv29b8/6kvhVu/PuDrCTzN88sprK+GtjS49jcqV2ek9I\r\nCMQ0FTbWRcC6H3ZzrF67RvAQalFThNHz/iHaNGCOrL4RcorVAS3/NfsKjSlA\r\nFgggnxSyvlzO3oF6aipvMXbDnLph+72kerUHkYhMjm3Q5rNUzWactvflEd1W\r\no15CXBJtSogW6nD9k2ipngYw9D4oEMqAZ/pCoVaKpbr+PPa0EEUG24Mc2EoL\r\npOusfzLJx2gH6MhoVd1fQdas0DaRP9LkTKs/nIvUZIZG3RR4PoKjB3je6p5Y\r\n6AkYdr/KGitb6a34U7ywEFZ8JS020gOPquCFEx97w9W8RAvR3kExkJx+7N3n\r\nzjt53xOf7+Swb47gHvAiIyyIDbPRZaxPg1A=\r\n=u6Ft\r\n-----END PGP SIGNATURE-----\r\n","size":2391,"noattachment":false,"key":"/cidr-regex/-/cidr-regex-4.0.3.tgz"},"_npmUser":{"name":"silverwind","email":"npm@silverwind.io"},"directories":{},"maintainers":[{"name":"silverwind","email":"npm@silverwind.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cidr-regex_4.0.3_1680203720756_0.19613861226077312"},"_hasShrinkwrap":false,"readme":"# cidr-regex\n[![](https://img.shields.io/npm/v/cidr-regex.svg?style=flat)](https://www.npmjs.org/package/cidr-regex) [![](https://img.shields.io/npm/dm/cidr-regex.svg)](https://www.npmjs.org/package/cidr-regex) [![](https://packagephobia.com/badge?p=cidr-regex)](https://packagephobia.com/result?p=cidr-regex)\n\n> Regular expression for matching IP addresses in CIDR notation\n\n## Usage\n\n```sh\n$ npm i cidr-regex\n```\n\n```js\nimport cidrRegex from \"cidr-regex\";\n\n// Contains a CIDR IP address?\ncidrRegex().test(\"foo 192.168.0.1/24\");\n//=> true\n\n// Is a CIDR IP address?\ncidrRegex({exact: true}).test(\"foo 192.168.0.1/24\");\n//=> false\n\ncidrRegex.v6({exact: true}).test(\"1:2:3:4:5:6:7:8/64\");\n//=> true\n\n// Extract CIDRs from string\n\"foo 192.168.0.1/24 bar 1:2:3:4:5:6:7:8/64 baz\".match(cidrRegex());\n//=> [\"192.168.0.1/24\", \"1:2:3:4:5:6:7:8/64\"]\n```\n\n## API\n### cidrRegex([options])\n\nReturns a regex for matching both IPv4 and IPv6 CIDR IP addresses.\n\n### cidrRegex.v4([options])\n\nReturns a regex for matching IPv4 CIDR IP addresses.\n\n### cidrRegex.v6([options])\n\nReturns a regex for matching IPv6 CIDR IP addresses.\n\n#### options.exact\n\nType: `boolean`<br>\nDefault: `false` *(Matches any CIDR IP address in a string)*\n\nOnly match an exact string. Useful with `RegExp#test()` to check if a string is a CIDR IP address.\n\n## Related\n\n- [ip-bigint](https://github.com/silverwind/ip-bigint) - Convert IPv4 and IPv6 addresses to native BigInt and vice-versa\n- [ip-regex](https://github.com/sindresorhus/ip-regex) - Regular expression for matching IP addresses\n- [is-cidr](https://github.com/silverwind/is-cidr) - Check if a string is an IP address in CIDR notation\n- [is-ip](https://github.com/sindresorhus/is-ip) - Check if a string is an IP address\n- [cidr-tools](https://github.com/silverwind/cidr-tools) - Tools to work with IPv4 and IPv6 CIDR network lists\n\n## License\n\n© [silverwind](https://github.com/silverwind), distributed under BSD licence\n\nBased on previous work by [Felipe Apostol](https://github.com/flipjs)\n","publish_time":1680203720914,"_cnpm_publish_time":1680203720914,"dist-tags":{"latest":"7.1.2"}}