Regex Range Generator

JSON →
library 5.0.1 ·javascript
verified May 27, 2026

to-regex-range is a utility library that generates a regex-compatible source string for matching numeric ranges. It simplifies the complex task of creating regular expressions for ranges like '1 to 50' or '0001 to 5555', which can quickly become unwieldy to write manually. The current stable version is 5.0.1. While a specific release cadence isn't published, the library maintains a stable API. Key differentiators include its convenience in abstracting complex regex logic, extensive test validation (over 2.78 million assertions), and optimizations that produce smaller, efficient regular expressions by reducing duplicate sequences and utilizing fragment caching. It handles zero-padding and negative numbers, making it robust for various validation or parsing scenarios.

total hits 12
actors 5 distinct systems
last hit 5d ago AhrefsBot
GPTBot
5
Script
1
Search engines
2

top countries 🇺🇸 United States · 🇨🇦 Canada · 🇫🇷 France · 🇩🇪 Germany