npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@regexto/validators

v1.0.3

Published

A curated collection of battle-tested regex patterns with TypeScript types, Zod integration, and multi-language code generation.

Downloads

479

Readme

📦 @regexto/validators

Curated, production-ready, and battle-tested regex patterns with native TypeScript support, Zod integration, and multi-language compilation.

All patterns are open-source, fully tested, and visualized live on regex.to.

npm pypi crates.io packagist pkg.go.dev Tested & Visualized Live


Why @regexto/validators?

  • 🔍 Tested and Visualized Live: Every single pattern in this library can be searched, tested, and visualized interactively at regex.to.
  • 🚀 Zero Dependencies: Pure JavaScript/TypeScript validator package. Lightweight and lightning-fast.
  • 🛠️ Zod v4 Ready: Built-in integration for type-safe form schema validation out of the box.
  • 📁 JSON Single Source of Truth: Patterns are declared declaratively in standard JSON files.

Installation

npm install @regexto/validators

# Optional: if you use Zod validation
npm install zod

Quick Start

1. Basic Validation (JavaScript / TypeScript)

import { test, validate, getRegex } from '@regexto/validators';

// 1. Quick boolean test
test('email', '[email protected]');   // → true
test('email', 'invalid-email');      // → false

// 2. Full validation with capture group outputs
const result = validate('ipv4', '192.168.1.1');
console.log(result.valid); // → true

// 3. Extract the raw RegExp instance
const emailRegex = getRegex('email'); // → RegExp instance

2. Type-Safe Zod Schema Integration

import { z } from 'zod';
import { zodSchema, zodObjectSchema } from '@regexto/validators/zod';

// Create a single-field validator schema
const emailValidator = zodSchema('email');
emailValidator.parse('[email protected]'); // ✓ Valid

// Easily construct object validation shapes
const registrationSchema = zodObjectSchema({
  email: 'email',
  website: 'url',
  zipCode: 'us-zip',
});

type RegistrationData = z.infer<typeof registrationSchema>;

3. Smart Type Auto-Detection

Pass an unknown string, and the validator will identify matching formats:

import { detect } from '@regexto/validators';

const matches = detect('0x742d35Cc6634C0532925a3b844Bc454e4438f44e');
// → [{ pattern: { slug: 'ethereum-address', ... }, matchType: 'full', coverage: 1 }]

Available Patterns

Here is a curated subset of the 79+ patterns supported. View all of them and test them live at regex.to/patterns:

| Slug | Name | Category | Live Sandbox | |------|------|----------|--------------| | email | Email Address | Internet | Test Live ↗ | | url | URL (HTTP/HTTPS) | Internet | Test Live ↗ | | ipv4 | IPv4 Address | Network | Test Live ↗ | | ipv6 | IPv6 Address | Network | Test Live ↗ | | hex-color | Hex Color | Design | Test Live ↗ | | semver | Semantic Version | Dev | Test Live ↗ | | uuid | UUID | Dev | Test Live ↗ | | credit-card | Credit Card Number | Finance | Test Live ↗ | | iban | IBAN | Finance | Test Live ↗ | | pl-nip | Polish NIP (Tax ID) | Finance | Test Live ↗ | | pl-pesel | Polish PESEL | Identity | Test Live ↗ | | us-zip | US ZIP Code | Address | Test Live ↗ | | uk-postcode | UK Postcode | Address | Test Live ↗ |


Contributing

Adding new patterns is fully automated. Simply create a JSON file inside the patterns/ directory of the repository and open a Pull Request:

{
  "slug": "my-custom-pattern",
  "name": "My Custom Pattern",
  "description": "Validates custom formats",
  "category": "Web",
  "pattern": "your[regex]+",
  "flags": "i",
  "examples": ["validexample"],
  "counterExamples": ["invalidexample"],
  "tags": ["custom"]
}

The newly added pattern will be parsed automatically at build-time by both the NPM package and the regex.to dynamic website.


License

Released under the MIT License. Developed and maintained by the regex.to team.