{"name":"cidr-regex","version":"4.0.2","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"},"keywords":["cidr","regex","notation","cidr notation","prefix","prefixes","ip","ip address"],"dependencies":{"ip-regex":"^5.0.0"},"devDependencies":{"eslint":"8.23.1","eslint-config-silverwind":"54.0.2","jest":"29.0.3","jest-extended":"3.1.0","tsd":"0.24.1","updates":"13.1.5","versions":"9.3.0"},"types":"./index.d.ts","gitHead":"0f33c91063cc6855261a2a8db1834aa877d75257","bugs":{"url":"https://github.com/silverwind/cidr-regex/issues"},"homepage":"https://github.com/silverwind/cidr-regex#readme","_id":"cidr-regex@4.0.2","_nodeVersion":"18.8.0","_npmVersion":"8.19.1","dist":{"integrity":"sha512-xvqVyyE8emYjipWVxsA+Vcsbt8TbJJsTHbOeMMA5qsmXUu5VZJzNBGwI4rr1IZ0FQI2z7bfry4NNACP5Cf67CA==","shasum":"ca8216d1761eed0bd9c4f5e8740f2d7363dd05bb","tarball":"http://registry-npm.ywwl.com/cidr-regex/download/cidr-regex-4.0.2.tgz","fileCount":5,"unpackedSize":5974,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC6P+Z8SBVxJlpnXouozhr/ZxRQuP+B1NRhOMFlZqo1HgIhAIR7NXxjDMa68wbay303pivsLcbPxZ7Ft+wSU32HP9zR"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjKhc8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrLpA//dVOFJaUXH6VMnTjy7ezt+3bMYX9N2TuDTnbJ4i4YDSJUmrJl\r\n6+168jkGZhFyB7lZSY7PY3qA4rWICov3WmiU6i3YC/zPFXSdYX3hAwuF62UY\r\n07yBldFn+T5HlfZdMpK5ktXboAvoTOsTCeZBWDcjkyDJpIVcEhzO42RWjTsT\r\n9s/cCrlpIuhJF+1DPB1bGhdPYriMbsOx9O2dcNfTxXInPT259ZToqNATdGFn\r\n9oG5UDVAco5zUC60OHgba5/glmLjM4x73C91grLag64DFwj5pirr4TmiSgxv\r\nUN57EVcX4MBddrNGJtt8QpDeODob1G8stEVqs2fXxZ41AfeQMQ4y7vM8Ik1t\r\nidk9bs0qMu4NoZVS5hb3HtQshFaSSQl1n/r7E+G2oZZ9y43OyFOJdDeYOLNn\r\nTAjbdCGG3JclYzNe6uGFvnfjIaL8mxcboMbMI3n6aljqcdvmJq01BcuwjP+y\r\nrznjRUYo/uRLW8cJcq9rCK/l7eLu2Dn0ddJu5L5byuRPvbLdhyZZVCgFoxVI\r\n6L0TX7K3IIlWx+Z8c4IxiOcP+O3m2GLVu8PDtNfPs5T7QXWL/jBjYK+Xn48q\r\n4LGgRBf9h+X4awjAb5y1o6/l2rmJEfeltbXrIJ17sQzGQn3tDksW+fqlE4f7\r\nhhZ2EyA+B3mFnFR3kFDxXJr4TTNFqfD6wDA=\r\n=HrwY\r\n-----END PGP SIGNATURE-----\r\n","size":2428,"noattachment":false,"key":"/cidr-regex/-/cidr-regex-4.0.2.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.2_1663702844077_0.9726152777688473"},"_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":1663702844238,"_cnpm_publish_time":1663702844238,"dist-tags":{"latest":"7.1.2"}}