
Security News
PHP Foundation Says Chainguard Broke Security Embargo Ahead of Emergency Patches
The PHP Foundation says Chainguard broke a security embargo ahead of critical RCE patches, as leaks disrupted the coordinated release.
A drop-in replacement for new RegExp() with types
The regex function creates a Regex instance with types for .test(), .exec() and more, statically parsed from native JS syntax:
import { regex } from "arkregex"
const ok = regex("^ok$", "i")
// Regex<"ok" | "oK" | "Ok" | "OK", { flags: "i" }>
const semver = regex("^(\\d*)\\.(\\d*)\\.(\\d*)$")
// Regex<`${number}.${number}.${number}`, { captures: [`${number}`, `${number}`, `${number}`] }>
const email = regex("^(?<name>\\w+)@(?<domain>\\w+\\.\\w+)$")
// Regex<`${string}@${string}.${string}`, { names: { name: string; domain: `${string}.${string}`; }; ...>
All you need to get started is pnpm install arkregex (or the equivalent for your package manager of choice) 🎉
Performs best with TS 5.9+
new RegExp()[a-Z] inferred more precisely?Constructing 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.
We've tried to strike a balance between performance and precision while guaranteeing that the inferred types are at worst imprecise and never incorrect.
If your expression is especially long or complex, TypeScript won't be able to infer it.
If your types start to slow down or you see the dreaded Type is excessively deep..., you can manually type your expression using regex.as:
const complexPattern = regex.as<`pattern-${string}`, { captures: [string] }>(
"very-long-complex-expression-here"
)
arkregex types are extensively tested and benchmarked using attest.
If anything not covered by the other FAQs is not behaving how you'd expect, please don't hesitate to create an issue.
regex?The ArkType extension can be installed to add syntax highlighting to regex calls.
FAQs
A drop-in replacement for new RegExp() with types
The npm package arkregex receives a total of 844,793 weekly downloads. As such, arkregex popularity was classified as popular.
We found that arkregex demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
The PHP Foundation says Chainguard broke a security embargo ahead of critical RCE patches, as leaks disrupted the coordinated release.

Security News
PHP releases emergency patches for two critical RCE vulnerabilities as agencies urge organizations to take unpatched sites offline.

Threat Research
/Security News
A supply chain attack compromised LiteLLM 1.107.0 on PyPI and Docker, spreading malware that steals cloud credentials, developer secrets, and AI provider keys.