Static type inference
Named captures are inferred directly from your builder chain at compile time. No type assertions, no as string, no surprises.
Stateless execution
Every .exec() call creates a fresh RegExp instance, making global-flag iteration safe and free of lastIndex bugs.
Automatic escaping
.literal() and .anyOf() auto-escape special characters. You cannot accidentally inject a malformed pattern through these methods.
Deep optionality
Quantifiers like .optional() and .zeroOrMore() automatically mark inner capture types as string | undefined in the result.
Zero dependencies
Built entirely on standard TypeScript and native RegExp. Nothing extra is installed at runtime.
Immutable builder
Every method call returns a new RegexBuilder instance. You can safely branch a base pattern into multiple variations without side effects.