{"_id":"arkregex","_rev":"5-062fd9d81304bcb3979c695925302d74","name":"arkregex","dist-tags":{"latest":"0.0.5"},"versions":{"0.0.1":{"name":"arkregex","version":"0.0.1","author":{"url":"https://arktype.io","name":"David Blass","email":"david@arktype.io"},"license":"MIT","_id":"arkregex@0.0.1","maintainers":[{"name":"ssalbdivad","email":"david@arktype.io"}],"dist":{"shasum":"c853ee28717ff918a4a98eb66dfec29f263f03d1","tarball":"https://registry.npmjs.org/arkregex/-/arkregex-0.0.1.tgz","fileCount":21,"integrity":"sha512-e9iX/j8SYc2XrCXL+g6IJybiAhc4fZ/HEnrPejllKp8QM1mx5jFcH7q2GtWhVU0aISaDfOK9PW92nR4zZnXsTg==","signatures":[{"sig":"MEQCIHffDy1b3HlUHPMwCWYDtT2blzphpwaIcZVhNMVNg2eoAiA9WmU1TOTavjF70wlMy/v3R6PrrHnZErmHEtkHLqiWCg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":47475},"main":"./out/index.js","type":"module","_from":"file:arkregex-0.0.1.tgz","types":"./out/index.d.ts","exports":{".":{"ark-ts":"./index.ts","default":"./out/index.js"},"./internal/*.js":{"ark-ts":"./*.ts","default":"./out/*.js"},"./internal/*.ts":{"ark-ts":"./*.ts","default":"./out/*.js"}},"scripts":{"test":"ts ../repo/testPackage.ts","bench":"ts ./__tests__/regex.bench.ts","build":"ts ../repo/build.ts"},"_npmUser":{"name":"ssalbdivad","email":"david@arktype.io"},"_resolved":"/tmp/7afca0ed429a860885ef3c526e960c90/arkregex-0.0.1.tgz","_integrity":"sha512-e9iX/j8SYc2XrCXL+g6IJybiAhc4fZ/HEnrPejllKp8QM1mx5jFcH7q2GtWhVU0aISaDfOK9PW92nR4zZnXsTg==","_npmVersion":"10.9.3","description":"A drop-in replacement for new RegExp() with types","directories":{},"_nodeVersion":"22.20.0","dependencies":{"@ark/util":"0.52.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/arkregex_0.0.1_1761643897703_0.19972134538877095","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"arkregex","version":"0.0.2","author":{"url":"https://arktype.io","name":"David Blass","email":"david@arktype.io"},"license":"MIT","_id":"arkregex@0.0.2","maintainers":[{"name":"ssalbdivad","email":"david@arktype.io"}],"dist":{"shasum":"62867941bffc5ed1a682a7fdb6cbf1db0e0e36a7","tarball":"https://registry.npmjs.org/arkregex/-/arkregex-0.0.2.tgz","fileCount":21,"integrity":"sha512-ttjDUICBVoXD/m8bf7eOjx8XMR6yIT2FmmW9vsN0FCcFOygEZvvIX8zK98tTdXkzi0LkRi5CmadB44jFEIyDNA==","signatures":[{"sig":"MEUCIGL/9ARKzokVEnNwdivLy2Vx7RBQWiHr0Jw4kklWcd8TAiEAirUIAazvWTkVAw6KreTd91SlgcjkqHrntT7415TGc00=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":47467},"main":"./out/index.js","type":"module","_from":"file:arkregex-0.0.2.tgz","types":"./out/index.d.ts","exports":{".":{"ark-ts":"./index.ts","default":"./out/index.js"},"./internal/*.js":{"ark-ts":"./*.ts","default":"./out/*.js"},"./internal/*.ts":{"ark-ts":"./*.ts","default":"./out/*.js"}},"scripts":{"test":"ts ../repo/testPackage.ts","bench":"ts ./__tests__/regex.bench.ts","build":"ts ../repo/build.ts"},"_npmUser":{"name":"ssalbdivad","email":"david@arktype.io"},"_resolved":"/tmp/78af3807d2055358717dd0b79b7af802/arkregex-0.0.2.tgz","_integrity":"sha512-ttjDUICBVoXD/m8bf7eOjx8XMR6yIT2FmmW9vsN0FCcFOygEZvvIX8zK98tTdXkzi0LkRi5CmadB44jFEIyDNA==","_npmVersion":"10.9.3","description":"A drop-in replacement for new RegExp() with types","directories":{},"_nodeVersion":"22.20.0","dependencies":{"@ark/util":"0.53.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/arkregex_0.0.2_1761667194416_0.7554703963900913","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"arkregex","version":"0.0.3","author":{"url":"https://arktype.io","name":"David Blass","email":"david@arktype.io"},"license":"MIT","_id":"arkregex@0.0.3","maintainers":[{"name":"ssalbdivad","email":"david@arktype.io"}],"dist":{"shasum":"2e2bdce5223e737cc134e4b0c9f228111d8cca57","tarball":"https://registry.npmjs.org/arkregex/-/arkregex-0.0.3.tgz","fileCount":21,"integrity":"sha512-bU21QJOJEFJK+BPNgv+5bVXkvRxyAvgnon75D92newgHxkBJTgiFwQxusyViYyJkETsddPlHyspshDQcCzmkNg==","signatures":[{"sig":"MEYCIQDMCjPiK5eqOuRi8odGxasKRoere2qrqqfcrN6xpEHDQAIhALAKz+yZW4hLL2CSdCv0lLGRugXerjQb7ECa4dI2utbP","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":48362},"main":"./out/index.js","type":"module","_from":"file:arkregex-0.0.3.tgz","types":"./out/index.d.ts","exports":{".":{"ark-ts":"./index.ts","default":"./out/index.js"},"./internal/*.js":{"ark-ts":"./*.ts","default":"./out/*.js"},"./internal/*.ts":{"ark-ts":"./*.ts","default":"./out/*.js"}},"scripts":{"test":"ts ../repo/testPackage.ts","bench":"ts ./__tests__/regex.bench.ts","build":"ts ../repo/build.ts"},"_npmUser":{"name":"ssalbdivad","email":"david@arktype.io"},"_resolved":"/tmp/ef47ec9092d6cc8b21fe572c19bf3dd4/arkregex-0.0.3.tgz","_integrity":"sha512-bU21QJOJEFJK+BPNgv+5bVXkvRxyAvgnon75D92newgHxkBJTgiFwQxusyViYyJkETsddPlHyspshDQcCzmkNg==","_npmVersion":"11.6.2","description":"A drop-in replacement for new RegExp() with types","directories":{},"_nodeVersion":"24.11.1","dependencies":{"@ark/util":"0.55.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/arkregex_0.0.3_1763387387779_0.07691760758885247","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"arkregex","version":"0.0.4","author":{"url":"https://arktype.io","name":"David Blass","email":"david@arktype.io"},"license":"MIT","_id":"arkregex@0.0.4","maintainers":[{"name":"ssalbdivad","email":"david@arktype.io"}],"dist":{"shasum":"b7e0ea90e9a399750714caf8399dbb1f67b3066d","tarball":"https://registry.npmjs.org/arkregex/-/arkregex-0.0.4.tgz","fileCount":21,"integrity":"sha512-biS/FkvSwQq59TZ453piUp8bxMui11pgOMV9WHAnli1F8o0ayNCZzUwQadL/bGIUic5TkS/QlPcyMuI8ZIwedQ==","signatures":[{"sig":"MEYCIQCXgkWzw1xyRYUI1iSd7EcZeUmmfqcmqYF9Q50M6KtQZAIhAMbpBmmN0jeANseWKuT037oStfB7T07qxjRMxG3jLU/C","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":48180},"main":"./out/index.js","type":"module","_from":"file:arkregex-0.0.4.tgz","types":"./out/index.d.ts","exports":{".":{"ark-ts":"./index.ts","default":"./out/index.js"},"./internal/*.js":{"ark-ts":"./*.ts","default":"./out/*.js"},"./internal/*.ts":{"ark-ts":"./*.ts","default":"./out/*.js"}},"scripts":{"test":"ts ../repo/testPackage.ts","bench":"ts ./__tests__/regex.bench.ts","build":"ts ../repo/build.ts"},"_npmUser":{"name":"ssalbdivad","email":"david@arktype.io"},"_resolved":"/tmp/bb334faa6157c2948e7a096e5edf8e67/arkregex-0.0.4.tgz","_integrity":"sha512-biS/FkvSwQq59TZ453piUp8bxMui11pgOMV9WHAnli1F8o0ayNCZzUwQadL/bGIUic5TkS/QlPcyMuI8ZIwedQ==","_npmVersion":"11.6.2","description":"A drop-in replacement for new RegExp() with types","directories":{},"_nodeVersion":"24.11.1","dependencies":{"@ark/util":"0.56.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/arkregex_0.0.4_1764743377500_0.019895689529914273","host":"s3://npm-registry-packages-npm-production"}},"0.0.5":{"name":"arkregex","description":"A drop-in replacement for new RegExp() with types","version":"0.0.5","license":"MIT","author":{"name":"David Blass","email":"david@arktype.io","url":"https://arktype.io"},"type":"module","main":"./out/index.js","types":"./out/index.d.ts","exports":{".":{"ark-ts":"./index.ts","default":"./out/index.js"},"./internal/*.ts":{"ark-ts":"./*.ts","default":"./out/*.js"},"./internal/*.js":{"ark-ts":"./*.ts","default":"./out/*.js"}},"dependencies":{"@ark/util":"0.56.0"},"publishConfig":{"access":"public"},"scripts":{"build":"ts ../repo/build.ts","test":"ts ../repo/testPackage.ts","bench":"ts ./__tests__/regex.bench.ts"},"_id":"arkregex@0.0.5","_integrity":"sha512-ncYjBdLlh5/QnVsAA8De16Tc9EqmYM7y/WU9j+236KcyYNUXogpz3sC4ATIZYzzLxwI+0sEOaQLEmLmRleaEXw==","_resolved":"/tmp/79cce3bc71f6826f4f05f2860428312f/arkregex-0.0.5.tgz","_from":"file:arkregex-0.0.5.tgz","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-ncYjBdLlh5/QnVsAA8De16Tc9EqmYM7y/WU9j+236KcyYNUXogpz3sC4ATIZYzzLxwI+0sEOaQLEmLmRleaEXw==","shasum":"0a2d5f6ae11de6b6200f2326f65960f85dac62fb","tarball":"https://registry.npmjs.org/arkregex/-/arkregex-0.0.5.tgz","fileCount":21,"unpackedSize":48406,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFY+JmRsPen3TiXQ33mGswN6Yu6g+5SOg7YDoHs6emm4AiAFSDoiaatp6NL2QWiKZqV99Er4C+/lSZCil5uHFDtlJw=="}]},"_npmUser":{"name":"ssalbdivad","email":"david@arktype.io"},"directories":{},"maintainers":[{"name":"ssalbdivad","email":"david@arktype.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/arkregex_0.0.5_1765600681680_0.7617951496136726"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-28T09:31:37.582Z","modified":"2025-12-13T04:38:02.117Z","0.0.1":"2025-10-28T09:31:37.881Z","0.0.2":"2025-10-28T15:59:54.609Z","0.0.3":"2025-11-17T13:49:47.963Z","0.0.4":"2025-12-03T06:29:37.684Z","0.0.5":"2025-12-13T04:38:01.831Z"},"author":{"name":"David Blass","email":"david@arktype.io","url":"https://arktype.io"},"license":"MIT","description":"A drop-in replacement for new RegExp() with types","maintainers":[{"name":"ssalbdivad","email":"david@arktype.io"}],"readme":"# arkregex\n\nA drop-in replacement for `new RegExp()` with types\n\n## Usage\n\nThe `regex` function creates a `Regex` instance with types for `.test()`, `.exec()` and more, statically parsed from native JS syntax:\n\n```ts\nimport { regex } from \"arkregex\"\n\nconst ok = regex(\"^ok$\", \"i\")\n// Regex<\"ok\" | \"oK\" | \"Ok\" | \"OK\", { flags: \"i\" }>\n\nconst semver = regex(\"^(\\\\d*)\\\\.(\\\\d*)\\\\.(\\\\d*)$\")\n// Regex<`${number}.${number}.${number}`, { captures: [`${number}`, `${number}`, `${number}`] }>\n\nconst email = regex(\"^(?\\\\w+)@(?\\\\w+\\\\.\\\\w+)$\")\n// Regex<`${string}@${string}.${string}`, { names: { name: string; domain: `${string}.${string}`; }; ...>\n```\n\nAll you need to get started is `pnpm install arkregex` (or the equivalent for your package manager of choice) 🎉\n\nPerforms best with TS 5.9+\n\n### Features\n\n- **Types**: Infers string types for your existing regular expressions, including positional and named captures\n- **Parity**: Supports 100% of [features](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions) allowed by `new RegExp()`\n- **Safety**: Syntax errors like referencing a group that doesn't exist are now type errors\n- **Zero Runtime**: Improves your type safety without impacting your bundle size\n\n### FAQ\n\n#### Why aren't some patterns like `[a-Z]` inferred more precisely?\n\nConstructing string literal types for these sorts of expressions is combinatorial and will explode very quickly if we infer character ranges like this as literal characters.\n\nWe've tried to strike a balance between performance and precision while guaranteeing that the inferred types are at worst imprecise and never incorrect.\n\n#### Why doesn't it work with my massive RegExp?\n\nIf your expression is especially long or complex, TypeScript won't be able to infer it.\n\nIf your types start to slow down or you see the dreaded `Type is excessively deep...`, you can manually type your expression using `regex.as`:\n\n```ts\nconst complexPattern = regex.as<`pattern-${string}`, { captures: [string] }>(\n\t\"very-long-complex-expression-here\"\n)\n```\n\n#### Is it robust?\n\n`arkregex` types are [extensively tested](https://github.com/arktypeio/arktype/tree/main/ark/regex/__tests__/regex.test.ts) and [benchmarked](https://github.com/arktypeio/arktype/tree/main/ark/regex/__tests__/regex.bench.ts) using [attest](https://github.com/arktypeio/arktype/tree/main/ark/attest#readme).\n\nIf anything not covered by the other FAQs is not behaving how you'd expect, please don't hesitate to [create an issue](https://github.com/arktypeio/arktype/issues/new).\n\n#### How can I get syntax highlighting for `regex`?\n\nThe [ArkType extension](https://marketplace.visualstudio.com/items?itemName=arktypeio.arkdark) can be installed to add syntax highlighting to `regex` calls.\n","readmeFilename":"README.md"}